#ifndef RUBehaviacTree_h #define RUBehaviacTree_h #include "RUDefine.h" #include "behaviac/behaviac.h" NS_RU_BEGIN class RUBehaviacTree : public behaviac::Agent { friend class RUBehaviacTreeManger; public: RUBehaviacTree(); virtual ~RUBehaviacTree(); bool loadBt(const std::string& btName); virtual void setData(const std::map& stringMap); void runBehaviacTree(); void runBehaviacTree(const std::map& stringMap, std::function treeRunEndCb, bool removeSelf = false ); bool isRunning(); protected: behaviac::EBTStatus _runIntervalAction(const std::string& actKey, const std::function)>& actFunc); private: void _update(); private: bool _isRunning = false; std::function _treeRunEndCb = nullptr; std::string _actKey; behaviac::EBTStatus _actStatus = behaviac::EBTStatus::BT_INVALID; bool _removeSelf = false; }; NS_RU_END #endif /* RUBehaviacTree_h */