1
This commit is contained in:
parent
88464b5a59
commit
1dbae08b6f
20
cpp/btmgr.cc
20
cpp/btmgr.cc
@ -1,6 +1,5 @@
|
|||||||
#include "precompile.h"
|
#include "precompile.h"
|
||||||
|
|
||||||
#include "behaviac/behaviac.h"
|
|
||||||
#include "btmgr.h"
|
#include "btmgr.h"
|
||||||
|
|
||||||
namespace f8
|
namespace f8
|
||||||
@ -16,6 +15,12 @@ namespace f8
|
|||||||
behaviac::Workspace::GetInstance()->Cleanup();
|
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)
|
bool BtMgr::BtLoad(behaviac::Agent* agent, const char* relative_path, bool force)
|
||||||
{
|
{
|
||||||
if (!agent) {
|
if (!agent) {
|
||||||
@ -32,12 +37,20 @@ namespace f8
|
|||||||
agent->btsetcurrent(relative_path);
|
agent->btsetcurrent(relative_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BtMgr::BtExec(behaviac::Agent* agent)
|
behaviac::EBTStatus BtMgr::BtExec(behaviac::Agent* agent)
|
||||||
{
|
{
|
||||||
if (!agent) {
|
if (!agent) {
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
agent->btexec();
|
return agent->btexec();
|
||||||
|
}
|
||||||
|
|
||||||
|
behaviac::BehaviorTreeTask* BtMgr::BtGetCurrent(behaviac::Agent* agent)
|
||||||
|
{
|
||||||
|
if (!agent) {
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
return agent->btgetcurrent();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BtMgr::BtDestory(behaviac::Agent* agent)
|
void BtMgr::BtDestory(behaviac::Agent* agent)
|
||||||
@ -49,4 +62,3 @@ namespace f8
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "behaviac/behaviac.h"
|
||||||
|
|
||||||
namespace behaviac
|
namespace behaviac
|
||||||
{
|
{
|
||||||
class Agent;
|
class Agent;
|
||||||
@ -16,10 +18,12 @@ namespace f8
|
|||||||
public:
|
public:
|
||||||
void Init(const std::string& file_path);
|
void Init(const std::string& file_path);
|
||||||
void UnInit();
|
void UnInit();
|
||||||
|
void SetLogging(bool logging);
|
||||||
|
|
||||||
bool BtLoad(behaviac::Agent* agent, const char* relative_path, bool force = false);
|
bool BtLoad(behaviac::Agent* agent, const char* relative_path, bool force = false);
|
||||||
void BtSetCurrent(behaviac::Agent* agent, const char* relative_path);
|
void BtSetCurrent(behaviac::Agent* agent, const char* relative_path);
|
||||||
void BtExec(behaviac::Agent* agent);
|
behaviac::EBTStatus BtExec(behaviac::Agent* agent);
|
||||||
|
behaviac::BehaviorTreeTask* BtGetCurrent(behaviac::Agent* agent);
|
||||||
void BtDestory(behaviac::Agent* agent);
|
void BtDestory(behaviac::Agent* agent);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user