feat: defined state and state machine concepts
This commit is contained in:
parent
7c0b338f68
commit
7c4c75d193
5 changed files with 124 additions and 0 deletions
26
modules/wave_survival/state.h
Normal file
26
modules/wave_survival/state.h
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
#ifndef STATE_H
|
||||
#define STATE_H
|
||||
|
||||
#include "core/object/class_db.h"
|
||||
#include "core/object/object.h"
|
||||
class StateMachine;
|
||||
class Node;
|
||||
|
||||
class State : public Object {
|
||||
GDCLASS(State, Object);
|
||||
static void _bind_methods();
|
||||
|
||||
public:
|
||||
virtual void set_target(Node *target) {}
|
||||
virtual void enter_state() {}
|
||||
virtual void exit_state() {}
|
||||
virtual void process(double delta) {}
|
||||
virtual String get_next_state() const;
|
||||
void set_state_machine(StateMachine *machine);
|
||||
StateMachine *get_state_machine() const;
|
||||
|
||||
private:
|
||||
StateMachine *state_machine{ nullptr };
|
||||
};
|
||||
|
||||
#endif // !STATE_H
|
||||
Loading…
Add table
Add a link
Reference in a new issue