1
This commit is contained in:
parent
7ff312185a
commit
ede5a65bfd
@ -105,7 +105,7 @@ void Android::InternalUpdate(int delta_time)
|
||||
#endif
|
||||
Global::Instance()->verify_set_pos = 0;
|
||||
}
|
||||
f8::BtMgr::Instance()->BtExec(agent_);
|
||||
agent_->Exec();
|
||||
}
|
||||
|
||||
void Android::GiveEquip()
|
||||
|
@ -6,6 +6,8 @@
|
||||
#include "human.h"
|
||||
#include "movehelper.h"
|
||||
|
||||
#include "framework/cpp/btmgr.h"
|
||||
|
||||
BaseAgent::BaseAgent():behaviac::Agent()
|
||||
{
|
||||
|
||||
@ -20,6 +22,11 @@ bool BaseAgent::IsGameOver()
|
||||
return GetOwner()->room->IsGameOver();
|
||||
}
|
||||
|
||||
void BaseAgent::Exec()
|
||||
{
|
||||
last_exec_status_ = f8::BtMgr::Instance()->BtExec(this);
|
||||
}
|
||||
|
||||
bool BaseAgent::HasTarget(float range)
|
||||
{
|
||||
Human* enemy = GetOwner()->room->FindEnemy(GetOwner()->AsHuman(), range);
|
||||
@ -33,7 +40,9 @@ behaviac::EBTStatus BaseAgent::DoRunningCb()
|
||||
}
|
||||
status_ = status_runing_cb_();
|
||||
#ifdef DEBUG
|
||||
if ((GetOwner()->room->GetFrameNo() - status_frameno_) % SERVER_FRAME_RATE == 0) {
|
||||
if ((GetOwner()->room->GetFrameNo() - status_frameno_) % SERVER_FRAME_RATE == 0 ||
|
||||
last_status_ != status_) {
|
||||
last_status_ = status_;
|
||||
a8::XPrintf("Running Status:%s %d\n", {status_name_, status_});
|
||||
}
|
||||
#endif
|
||||
@ -47,6 +56,7 @@ behaviac::EBTStatus BaseAgent::StartCoroutine(std::function<behaviac::EBTStatus(
|
||||
const char* name)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
last_status_ = behaviac::BT_INVALID;
|
||||
status_frameno_ = GetOwner()->room->GetFrameNo();
|
||||
status_name_ = name;
|
||||
#endif
|
||||
|
@ -13,6 +13,9 @@ public:
|
||||
|
||||
BEHAVIAC_DECLARE_AGENTTYPE(BaseAgent, behaviac::Agent)
|
||||
|
||||
void Exec();
|
||||
behaviac::EBTStatus GetLastExecStatus() { return last_exec_status_; };
|
||||
|
||||
bool IsGameOver();
|
||||
bool HasTarget(float range);
|
||||
|
||||
@ -29,9 +32,11 @@ protected:
|
||||
|
||||
protected:
|
||||
#ifdef DEBUG
|
||||
behaviac::EBTStatus last_status_ = behaviac::BT_INVALID;
|
||||
long long status_frameno_ = 0;
|
||||
const char* status_name_ = nullptr;
|
||||
#endif
|
||||
behaviac::EBTStatus last_exec_status_ = behaviac::BT_INVALID;
|
||||
behaviac::EBTStatus status_= behaviac::BT_SUCCESS;
|
||||
std::function<behaviac::EBTStatus()> status_runing_cb_;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user