This commit is contained in:
aozhiwei 2022-12-06 19:22:08 +08:00
parent f5e5d0f2d2
commit 6e191ce542
4 changed files with 42 additions and 14 deletions

View File

@ -4,14 +4,13 @@
#include "android.h" #include "android.h"
#include "room.h" #include "room.h"
AndroidAgent::AndroidAgent() AndroidAgent::AndroidAgent():BaseAgent()
{ {
} }
AndroidAgent::~AndroidAgent() AndroidAgent::~AndroidAgent()
{ {
} }
State_e AndroidAgent::GetState() State_e AndroidAgent::GetState()
@ -19,11 +18,6 @@ State_e AndroidAgent::GetState()
return kPreBattle; return kPreBattle;
} }
bool AndroidAgent::IsGameOver()
{
return GetOwner()->room->IsGameOver();
}
behaviac::EBTStatus AndroidAgent::DoIdle(int min_time, int max_time) behaviac::EBTStatus AndroidAgent::DoIdle(int min_time, int max_time)
{ {
if (status_ == behaviac::BT_RUNNING) { if (status_ == behaviac::BT_RUNNING) {

View File

@ -1,20 +1,18 @@
#pragma once #pragma once
#include "behaviac_headers.h" #include "base_agent.h"
#include "behaviac_customized_types.h"
class Android; class Android;
class AndroidAgent : public behaviac::Agent class AndroidAgent : public BaseAgent
{ {
public: public:
AndroidAgent(); AndroidAgent();
virtual ~AndroidAgent(); virtual ~AndroidAgent();
BEHAVIAC_DECLARE_AGENTTYPE(AndroidAgent, behaviac::Agent) BEHAVIAC_DECLARE_AGENTTYPE(AndroidAgent, BaseAgent)
State_e GetState(); State_e GetState();
bool IsGameOver();
behaviac::EBTStatus DoIdle(int min_time, int max_time); behaviac::EBTStatus DoIdle(int min_time, int max_time);
behaviac::EBTStatus DoRandomWalk(); behaviac::EBTStatus DoRandomWalk();
@ -27,6 +25,4 @@ public:
private: private:
Android* owner_ = nullptr; Android* owner_ = nullptr;
behaviac::EBTStatus status_= behaviac::BT_SUCCESS;
std::function<behaviac::EBTStatus()> status_runing_cb_;
}; };

View File

@ -0,0 +1,18 @@
#include "precompile.h"
#include "base_agent.h"
#include "room.h"
BaseAgent::BaseAgent():behaviac::Agent()
{
}
BaseAgent::~BaseAgent()
{
}
bool BaseAgent::IsGameOver()
{
return false;
}

View File

@ -0,0 +1,20 @@
#pragma once
#include "behaviac/behaviac.h"
#include "behaviac_customized_types.h"
class BaseAgent : public behaviac::Agent
{
public:
BaseAgent();
virtual ~BaseAgent();
BEHAVIAC_DECLARE_AGENTTYPE(BaseAgent, behaviac::Agent)
bool IsGameOver();
protected:
behaviac::EBTStatus status_= behaviac::BT_SUCCESS;
std::function<behaviac::EBTStatus()> status_runing_cb_;
};