#ifndef STATE_HPP #define STATE_HPP #include #include #include template struct Transition { const std::string target_state; const std::function condition; }; template class State { public: virtual ~State() = default; virtual void OnEnter(OwnerType &owner) = 0; virtual void OnUpdate(OwnerType &owner) = 0; virtual void OnExit(OwnerType &owner) = 0; virtual void AddTransition(const std::string &to, std::function condition) = 0; virtual std::vector> GetTransitions() = 0; virtual std::string Id() const = 0; }; template class AState : public State { public: AState(const std::string &id) : entity_id(id) {}; void AddTransition(const std::string &to, std::function condition) override { transitions.push_back({ to, condition }); } std::vector> GetTransitions() override { return transitions; } std::string Id() const override { return entity_id; } private: std::vector> transitions; std::string entity_id; }; #endif // STATE_HPP