feat: reworked enemy wretched logic

This commit is contained in:
Sara 2025-07-21 23:17:37 +02:00
parent 2cd1cba04f
commit 74aead946c
2 changed files with 48 additions and 13 deletions

View file

@ -5,14 +5,24 @@
#include "wave_survival/state.h"
class PatrolPath;
class NpcUnit;
class AnimationPlayer;
class StateMachine;
class EnemyWretched : public EnemyBody {
GDCLASS(EnemyWretched, EnemyBody);
static void _bind_methods();
void on_child_entered(Node *node);
void ready();
protected:
void _notification(int what);
public:
AnimationPlayer *get_anim() const;
private:
StateMachine *fsm{ nullptr };
AnimationPlayer *anim{ nullptr };
};
/* ============================== STATES ============================== */
@ -26,11 +36,10 @@ public:
EnemyWretched *get_target() const;
NpcUnit *get_unit() const;
NavigationAgent3D *get_nav() const;
AnimationPlayer *get_anim() const;
private:
NpcUnit *unit{ nullptr };
EnemyWretched *target{ nullptr };
NavigationAgent3D *nav{ nullptr };
};
class WretchedPatrolState : public WretchedState {
@ -63,6 +72,7 @@ class WretchedAttackState : public WretchedState {
static void _bind_methods() {}
public:
virtual void enter_state() override;
virtual String get_next_state() const override;
};