This commit is contained in:
aozhiwei 2022-12-06 19:28:54 +08:00
parent 6e191ce542
commit f3da219517
4 changed files with 10 additions and 6 deletions

View File

@ -115,7 +115,7 @@ behaviac::EBTStatus AndroidAgent::DoAttack()
if (status_ == behaviac::BT_RUNNING) {
return status_runing_cb_();
}
Human* enemy = GetOwner()->room->FindEnemy(GetOwner());
Human* enemy = GetOwner()->room->FindEnemy(GetOwner()->AsHuman());
if (!enemy) {
return behaviac::BT_FAILURE;
}

View File

@ -19,10 +19,6 @@ public:
behaviac::EBTStatus DoRandomShot();
behaviac::EBTStatus DoAttack();
public:
void SetOwner(Android* owner) { owner_ = owner; };
Android* GetOwner() { return owner_; };
private:
Android* owner_ = nullptr;
};

View File

@ -3,6 +3,7 @@
#include "behaviac/behaviac.h"
#include "behaviac_customized_types.h"
class Creature;
class BaseAgent : public behaviac::Agent
{
public:
@ -14,7 +15,14 @@ public:
bool IsGameOver();
public:
void SetOwner(Creature* owner) { owner_ = owner; };
Creature* GetOwner() { return owner_; };
protected:
behaviac::EBTStatus status_= behaviac::BT_SUCCESS;
std::function<behaviac::EBTStatus()> status_runing_cb_;
private:
Creature* owner_ = nullptr;
};

@ -1 +1 @@
Subproject commit 88464b5a593f82ea8ff0f5698433bff9ae935518
Subproject commit 1dbae08b6f5d9e4df8325f5170a2355953ff4db8