12345678910111213141516171819202122232425262728 |
- /// 代理工厂
- #ifndef RUBehaviacTreeFactory_h
- #define RUBehaviacTreeFactory_h
- #include "RUDefine.h"
- #include "RUBehaviacTree.h"
- NS_RU_BEGIN
- class RUBehaviacTreeFactory
- {
- public:
- static RUBehaviacTreeFactory* getInstance();
- /// 向工厂注册一个状态代理类的注册器
- void registerBehaviacTreeCreator(const std::string& treeName, std::function<RUBehaviacTree*(void)> behaviacTreeCreator);
- RUBehaviacTree* createBehaviacTree(const std::string& treeName);
- private:
- RUBehaviacTreeFactory() = default;
- ~RUBehaviacTreeFactory() = default;
- private:
- std::map<std::string, std::function<RUBehaviacTree*(void)>> _behaviacTreeCreators;
- };
- NS_RU_END
- #endif /* RUBehaviacTreeFactory_h */
|