#ifndef STATE_MACHINE_H
#define STATE_MACHINE_H

#include "scene/main/node.h"
class State;

class StateMachine : public Node {
	GDCLASS(StateMachine, Node);
	static void _bind_methods();
	void switch_to_state(State *state);
	void process(double delta);

protected:
	void _notification(int what);

public:
	~StateMachine();
	void add_state(State *state);

private:
	State *current_state{ nullptr };
	bool current_state_is_active{ false };
	HashMap<StringName, State *> states{};
};

#endif // !STATE_MACHINE_H
