// // LoopWaiter.hpp // redream_runtime_mac // // Created by zhu on 2023/5/23. // #ifndef LoopWaiter_hpp #define LoopWaiter_hpp #include "WaitableStateBase.hpp" #include "behaviac/RedBehaviacTree.h" namespace redream { class LoopWaiter : public WaitableStateBase, public red::RedBehaviacTreeDelegate { public: static LoopWaiter* create(ReboltRedManager* reboltManager, red::RedBehaviacTree* tree, std::map &boolMap, std::map &stringMap, std::string treeName); LoopWaiter(ReboltRedManager* reboltManager, red::RedBehaviacTree* tree, std::map &boolMap, std::map &stringMap, std::string treeName); ~LoopWaiter(); bool init(); int getLoopTimes(); void onLoopEnd(); public: virtual void run() override; void onTreeRunningEnd(red::RedBehaviacTree* tree, int endType, std::string treeName) override; private: void createTreeAndRun(); private: int _loopTimes; std::string _treeName; std::map _boolMap; std::map _stringMap; bool _isLoopEnd; red::RedBehaviacTree* _tree; }; }; #endif /* LoopWaiter_hpp */