46 lines
1.1 KiB
C++
46 lines
1.1 KiB
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)
|
|
|
|
void Exec();
|
|
|
|
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();
|
|
behaviac::EBTStatus StartCoroutine(std::function<behaviac::EBTStatus()> cb,
|
|
std::function<void(bool, bool&)> event_cb,
|
|
const char* name);
|
|
|
|
protected:
|
|
#ifdef DEBUG
|
|
behaviac::EBTStatus last_status_ = behaviac::BT_INVALID;
|
|
long long status_frameno_ = 0;
|
|
const char* status_name_ = nullptr;
|
|
#endif
|
|
behaviac::EBTStatus status_= behaviac::BT_SUCCESS;
|
|
std::function<behaviac::EBTStatus()> runing_cb_;
|
|
std::function<void(bool, bool&)> event_cb_;
|
|
|
|
private:
|
|
Creature* owner_ = nullptr;
|
|
};
|