game2006/server/gameserver/base_agent.h
aozhiwei 9484b8dc14 1
2022-12-08 11:00:05 +08:00

35 lines
703 B
C++

#pragma once
#include "behaviac/behaviac.h"
#include "behaviac_customized_types.h"
class Creature;
class BaseAgent : public behaviac::Agent
{
public:
BaseAgent();
virtual ~BaseAgent();
BEHAVIAC_DECLARE_AGENTTYPE(BaseAgent, behaviac::Agent)
bool IsGameOver();
bool HasTarget(float range);
behaviac::EBTStatus CoAttackTarget(int target_id);
public:
void SetOwner(Creature* owner) { owner_ = owner; };
Creature* GetOwner() { return owner_; };
protected:
behaviac::EBTStatus DoRunningCb();
protected:
behaviac::EBTStatus status_= behaviac::BT_SUCCESS;
std::function<behaviac::EBTStatus()> status_runing_cb_;
private:
Creature* owner_ = nullptr;
};