This commit is contained in:
aozhiwei 2023-10-14 11:50:58 +08:00
parent dda5d1a4a7
commit 15488a4309

View File

@ -10,6 +10,7 @@
#include "target_agent.h" #include "target_agent.h"
#include "weapon.h" #include "weapon.h"
#include "mapinstance.h" #include "mapinstance.h"
#include "collision.h"
#include "mt/Hero.h" #include "mt/Hero.h"
#include "mt/Equip.h" #include "mt/Equip.h"
@ -247,18 +248,23 @@ bool HeroAgent::HasBuffEffect(int effect_id)
bool HeroAgent::IsNearGas(float range) bool HeroAgent::IsNearGas(float range)
{ {
float x_distance = std::fabs(owner_->GetPos().ToGlmVec3().x - return Collision::IsNearInRange
owner_->room->GetGasData().pos_old.x); (owner_->GetPos().ToGlmVec3(),
float z_distance = std::fabs(owner_->GetPos().ToGlmVec3().z - owner_->GetPos().ToGlmVec3(),
owner_->room->GetGasData().pos_old.y); range);
return false;
} }
bool HeroAgent::MasterInRange(float range) bool HeroAgent::MasterInRange(float range)
{ {
abort(); if (!owner_->IsHero() ||
!owner_->AsHero()->master.Get()) {
return false; return false;
} }
return Collision::IsNearInRange
(owner_->AsHero()->master.Get()->GetPos().ToGlmVec3(),
owner_->GetPos().ToGlmVec3(),
range);
}
behaviac::EBTStatus HeroAgent::SearchEnemy(float range) behaviac::EBTStatus HeroAgent::SearchEnemy(float range)
{ {