// // RUStateTransition.hpp // RoleTool // // Created by 徐炼新 on 2023/4/19. // #ifndef RUStateTransition_hpp #define RUStateTransition_hpp #include "cocos2d.h" #include "RUDefine.h" #include "RUStateMachine.h" NS_RU_BEGIN class StateTransition : public cocos2d::Ref { public: static StateTransition* create(StateMachine*, const FsmTransition*, std::function, bool)> cf); void setEvent(const std::string& eventName, const std::map& eventParams, std::function handleEventCb); /// 终止状态转移 void interrupt(); /// 执行状态转移 void execute(); private: StateTransition() = default; std::function, bool)> _cf = nullptr; StateMachine* _machine = nullptr; const FsmTransition* _transition = nullptr; void* _param = nullptr; std::string _eventName; std::map _eventParams; std::function _cf4Event = nullptr; bool _bIsInterrupted = false; }; NS_RU_END #endif /* RUStateTransition_hpp */