41 lines
952 B
C++
41 lines
952 B
C++
#ifndef ENEMY_HPP
|
|
#define ENEMY_HPP
|
|
|
|
#include "godot_cpp/classes/area3d.hpp"
|
|
#include "health.hpp"
|
|
#include <godot_cpp/classes/character_body3d.hpp>
|
|
|
|
namespace godot {
|
|
class PlayerCharacter;
|
|
class NavigationAgent3D;
|
|
|
|
class Enemy : public CharacterBody3D,
|
|
public IHealthEntity {
|
|
GDCLASS(Enemy, CharacterBody3D);
|
|
static void _bind_methods();
|
|
public:
|
|
virtual void _ready() override;
|
|
virtual void _process(double delta_time) override;
|
|
void process_navigation(double delta_time);
|
|
|
|
void body_entered_vision_area(Node3D *body);
|
|
|
|
void update_navigation_target();
|
|
|
|
virtual Health *get_health() override;
|
|
virtual Health const *get_health() const override;
|
|
|
|
private:
|
|
float renav_time{0.f};
|
|
|
|
PlayerCharacter *target_player{nullptr};
|
|
Health *health{nullptr};
|
|
NavigationAgent3D *nav_agent{nullptr};
|
|
Area3D *vision_area{nullptr};
|
|
|
|
static float const RENAV_INTERVAL;
|
|
};
|
|
}
|
|
|
|
#endif // !ENEMY_HPP
|