44 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			44 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
#ifndef ENEMY_BODY_H
 | 
						|
#define ENEMY_BODY_H
 | 
						|
 | 
						|
#include "scene/3d/navigation/navigation_agent_3d.h"
 | 
						|
#include "scene/3d/physics/character_body_3d.h"
 | 
						|
#include "wave_survival/health_status.h"
 | 
						|
#include "wave_survival/state_machine.h"
 | 
						|
class NpcUnit;
 | 
						|
 | 
						|
class EnemyBody : public CharacterBody3D {
 | 
						|
	GDCLASS(EnemyBody, CharacterBody3D);
 | 
						|
	static void _bind_methods();
 | 
						|
	void on_child_added(Node *node);
 | 
						|
	void ready();
 | 
						|
	void physics_process(double delta);
 | 
						|
 | 
						|
public:
 | 
						|
	void _notification(int what);
 | 
						|
 | 
						|
	void set_movement_direction(Vector2 direction);
 | 
						|
	void set_unit(NpcUnit *unit);
 | 
						|
	NpcUnit *get_unit() const;
 | 
						|
 | 
						|
	HealthStatus *get_health() const;
 | 
						|
	NavigationAgent3D *get_nav() const;
 | 
						|
	void set_movement_speed(float value);
 | 
						|
	float get_movement_speed() const;
 | 
						|
	void set_unit_offset(Vector2 offset);
 | 
						|
	Vector2 get_unit_offset() const;
 | 
						|
	Vector3 get_unit_offset_3d() const;
 | 
						|
 | 
						|
private:
 | 
						|
	float movement_speed{ 1.f };
 | 
						|
	Vector2 movement_direction{ 0, 0 };
 | 
						|
 | 
						|
	StateMachine *fsm{ nullptr };
 | 
						|
	NpcUnit *unit{ nullptr };
 | 
						|
	HealthStatus *health{ nullptr };
 | 
						|
	NavigationAgent3D *nav{ nullptr };
 | 
						|
	Vector2 unit_offset{ 0, 0 };
 | 
						|
};
 | 
						|
 | 
						|
#endif // !ENEMY_BODY_H
 |