1
This commit is contained in:
parent
f5e5d0f2d2
commit
6e191ce542
@ -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) {
|
||||||
|
@ -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_;
|
|
||||||
};
|
};
|
||||||
|
18
server/gameserver/base_agent.cc
Normal file
18
server/gameserver/base_agent.cc
Normal 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;
|
||||||
|
}
|
20
server/gameserver/base_agent.h
Normal file
20
server/gameserver/base_agent.h
Normal 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_;
|
||||||
|
};
|
Loading…
x
Reference in New Issue
Block a user