This commit is contained in:
aozhiwei 2023-04-03 19:15:16 +08:00
parent e0265b5ff4
commit 7b80205461

View File

@ -386,6 +386,10 @@ behaviac::EBTStatus HeroAgent::DoHelpAttack(int target_uniid)
target.Get()->GetPos().ToGlmVec3())) {
return behaviac::BT_FAILURE;
}
float distance = target.Get()->GetPos().Distance2D2(GetOwner()->GetPos());
if (distance > GetAttackRange()) {
return behaviac::BT_FAILURE;
}
bool shot_ok = false;
glm::vec3 shot_dir = GetOwner()->GetPos().CalcDir(target.Get()->GetPos());;
GlmHelper::Normalize(shot_dir);
@ -393,7 +397,7 @@ behaviac::EBTStatus HeroAgent::DoHelpAttack(int target_uniid)
if (bullet_trace_mode_) {
GetOwner()->Shot(shot_dir, shot_ok, 0, target.Get()->GetUniId());
} else {
GetOwner()->Shot(shot_dir, shot_ok, 0, target.Get()->GetUniId());
GetOwner()->Shot(shot_dir, shot_ok, 0, 0);
}
return behaviac::BT_RUNNING;