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,45 @@
#ifndef ENEMY_WRETCHED_H
#define ENEMY_WRETCHED_H
#include "wave_survival/enemy_body.h"
#include "wave_survival/state.h"
class PatrolPath;
class EnemyWretched : public EnemyBody {
GDCLASS(EnemyWretched, EnemyBody);
static void _bind_methods();
void ready();
protected:
void _notification(int what);
};
/* ============================== STATES ============================== */
class WretchedState : public State {
GDCLASS(WretchedState, State);
static void _bind_methods() {}
public:
virtual void set_target(Node *node) override;
EnemyWretched *get_target() const;
private:
EnemyWretched *target{ nullptr };
};
class WretchedPatrolState : public WretchedState {
GDCLASS(WretchedPatrolState, WretchedState);
static void _bind_methods() {}
public:
virtual void enter_state() override;
virtual void process(double delta) override;
private:
NavigationAgent3D *nav{ nullptr };
int path_point{ 0 };
PatrolPath *path{ nullptr };
};
#endif // !ENEMY_WRETCHED_H