wave-survival/modules/wave_survival/npc_unit.h

38 lines
889 B
C++

#ifndef NPC_UNIT_H
#define NPC_UNIT_H
#include "scene/3d/node_3d.h"
class StateMachine;
class EnemyBody;
class PatrolPath;
class MapRegion;
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;
void set_region(MapRegion *region);
MapRegion *get_region() const;
private:
bool aware_of_player{ false };
Vector<EnemyBody *> npcs{};
PatrolPath *patrol_path{ nullptr };
float patrol_speed{ 1.f };
MapRegion *region{ nullptr };
};
#endif // !NPC_UNIT_H