This commit is contained in:
aozhiwei 2023-11-21 15:55:07 +08:00
parent 76fa3716b9
commit 5704658ab5
3 changed files with 7 additions and 1 deletions

View File

@ -1593,7 +1593,7 @@ behaviac::EBTStatus HeroAgent::SearchTeammate(int range)
if (nearest_teammate) {
float distance = nearest_teammate->GetPos().Distance2D2(owner_->GetPos());
if (distance <= range) {
current_target_agent->SetTarget(nearest_teammate);
current_teammate_agent->SetTarget(nearest_teammate);
return behaviac::BT_SUCCESS;
}
}

View File

@ -115,3 +115,8 @@ bool TeammateAgent::HasBuffEffect(int effect_id)
{
return target_.Get() && target_.Get()->HasBuffEffect(effect_id);
}
void TeammateAgent::SetTarget(Creature* target)
{
target_ = target->GetWeakPtrRef();
}

View File

@ -28,6 +28,7 @@ public:
bool HasBuffEffect(int effect_id);
void SetOwner(Creature* owner);
void SetTarget(Creature* target);
virtual Room* GetRoom() override;
private: