This commit is contained in:
aozhiwei 2022-12-08 11:00:05 +08:00
parent d1772dd4b7
commit 9484b8dc14
2 changed files with 17 additions and 0 deletions

View File

@ -36,3 +36,18 @@ behaviac::EBTStatus BaseAgent::DoRunningCb()
} }
return status_; return status_;
} }
behaviac::EBTStatus BaseAgent::CoAttackTarget(int target_id)
{
if (status_ == behaviac::BT_RUNNING) {
return DoRunningCb();
}
status_runing_cb_ =
[this] () mutable
{
return status_;
};
status_ = behaviac::BT_RUNNING;
return status_;
}

View File

@ -16,6 +16,8 @@ public:
bool IsGameOver(); bool IsGameOver();
bool HasTarget(float range); bool HasTarget(float range);
behaviac::EBTStatus CoAttackTarget(int target_id);
public: public:
void SetOwner(Creature* owner) { owner_ = owner; }; void SetOwner(Creature* owner) { owner_ = owner; };
Creature* GetOwner() { return owner_; }; Creature* GetOwner() { return owner_; };