feat: first basic enemy patrolling behaviour

This commit is contained in:
Sara 2025-07-20 21:41:22 +02:00
parent 7c4c75d193
commit 526f756736
15 changed files with 801 additions and 386 deletions

View file

@ -0,0 +1,31 @@
#ifndef NPC_UNIT_H
#define NPC_UNIT_H
#include "scene/main/node.h"
class StateMachine;
class EnemyBody;
class PatrolPath;
class NpcUnit : public Node {
GDCLASS(NpcUnit, Node);
static void _bind_methods();
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:
Vector<EnemyBody *> npcs{};
PatrolPath *patrol_path{ nullptr };
float patrol_speed{ 3.f };
};
#endif // !NPC_UNIT_H