41 lines
		
	
	
		
			961 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			41 lines
		
	
	
		
			961 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 remove_npc(EnemyBody *unit);
 | 
						|
	void on_npc_death();
 | 
						|
	void on_npc_awareness_changed(bool seen);
 | 
						|
	void child_added(Node *node);
 | 
						|
	void enter_tree();
 | 
						|
	void ready();
 | 
						|
 | 
						|
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
 |