67 lines
1.4 KiB
C++
67 lines
1.4 KiB
C++
#include <a8/a8.h>
|
|
|
|
#include <f8/f8.h>
|
|
|
|
#include "btmgr.h"
|
|
|
|
namespace f8
|
|
{
|
|
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()
|
|
{
|
|
behaviac::Workspace::GetInstance()->Cleanup();
|
|
}
|
|
|
|
void BtMgr::SetLogging(bool logging)
|
|
{
|
|
behaviac::Config::SetLogging(logging);
|
|
behaviac::Config::SetLoggingFlush(true);
|
|
}
|
|
|
|
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);
|
|
}
|
|
|
|
behaviac::EBTStatus BtMgr::BtExec(behaviac::Agent* agent)
|
|
{
|
|
if (!agent) {
|
|
abort();
|
|
}
|
|
return agent->btexec();
|
|
}
|
|
|
|
behaviac::BehaviorTreeTask* BtMgr::BtGetCurrent(behaviac::Agent* agent)
|
|
{
|
|
if (!agent) {
|
|
abort();
|
|
}
|
|
return agent->btgetcurrent();
|
|
}
|
|
|
|
void BtMgr::BtDestory(behaviac::Agent* agent)
|
|
{
|
|
if (!agent) {
|
|
abort();
|
|
}
|
|
behaviac::Agent::Destroy(agent);
|
|
}
|
|
|
|
}
|