This commit is contained in:
aozhiwei 2019-10-09 11:35:37 +08:00
parent 3d62b9c0c3
commit d6038d8400
2 changed files with 21 additions and 14 deletions

View File

@ -5,39 +5,48 @@
namespace f8
{
void BtMgr::Init()
void BtMgr::Init(const std::string& file_path)
{
behaviac::Workspace::GetInstance()->SetFilePath(file_path.c_str());
behaviac::Workspace::GetInstance()->SetFileFormat(behaviac::Workspace::EFF_xml);
}
void BtMgr::UnInit()
{
}
void BtMgr::SetFilePath(const std::string& file_path)
{
behaviac::Workspace::GetInstance()->Cleanup();
}
bool BtMgr::BtLoad(behaviac::Agent* agent, const char* relative_path, bool force)
{
if (!agent) {
abort();
}
return agent->btload(relative_path, force);
}
void BtMgr::BtSetCurrent(behaviac::Agent* agent, const char* relative_path)
{
if (!agent) {
abort();
}
agent->btsetcurrent(relative_path);
}
void BtMgr::BtExec(behaviac::Agent* agent)
{
if (!agent) {
abort();
}
agent->btexec();
}
void BtMgr::BtDestory(behaviac::Agent* agent)
{
if (!agent) {
abort();
}
behaviac::Agent::Destroy(agent);
}
}

View File

@ -14,11 +14,9 @@ namespace f8
friend class a8::Singleton<BtMgr>;
public:
void Init();
void Init(const std::string& file_path);
void UnInit();
void SetFilePath(const std::string& file_path);
bool BtLoad(behaviac::Agent* agent, const char* relative_path, bool force = false);
void BtSetCurrent(behaviac::Agent* agent, const char* relative_path);
void BtExec(behaviac::Agent* agent);