34 lines
772 B
C++
34 lines
772 B
C++
#ifndef NPC_UNIT_H
|
|
#define NPC_UNIT_H
|
|
|
|
#include "scene/3d/node_3d.h"
|
|
class StateMachine;
|
|
class EnemyBody;
|
|
class PatrolPath;
|
|
|
|
class NpcUnit : public Node3D {
|
|
GDCLASS(NpcUnit, Node3D);
|
|
static void _bind_methods();
|
|
void on_npc_awareness_changed(bool seen);
|
|
void child_added(Node *node);
|
|
void enter_tree();
|
|
|
|
protected:
|
|
void _notification(int what);
|
|
|
|
public:
|
|
void set_patrol_path(PatrolPath *path);
|
|
PatrolPath *get_patrol_path() const;
|
|
bool is_aware_of_player() const; //!< becomes true when any individual in the unit sees the player.
|
|
void set_patrol_speed(float value);
|
|
float get_patrol_speed() const;
|
|
|
|
private:
|
|
bool aware_of_player{ false };
|
|
Vector<EnemyBody *> npcs{};
|
|
PatrolPath *patrol_path{ nullptr };
|
|
float patrol_speed{ 3.f };
|
|
};
|
|
|
|
#endif // !NPC_UNIT_H
|