This commit is contained in:
aozhiwei 2023-04-04 15:09:26 +08:00
parent c7f92ec486
commit 7e8a0b31bb

View File

@ -280,6 +280,10 @@ behaviac::EBTStatus HeroAgent::DoAttack()
target.Get()->GetPos().ToGlmVec3())) {
return behaviac::BT_FAILURE;
}
if (GetOwner()->dead) {
return behaviac::BT_FAILURE;
}
if (GetOwner()->CanShot(true)) {
bool shot_ok = false;
glm::vec3 shot_dir = GetOwner()->GetPos().CalcDir(target.Get()->GetPos());;
GlmHelper::Normalize(shot_dir);
@ -289,7 +293,7 @@ behaviac::EBTStatus HeroAgent::DoAttack()
} else {
GetOwner()->Shot(shot_dir, shot_ok, 0, target.Get()->GetUniId());
}
}
return behaviac::BT_RUNNING;
}
},