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

View File

@ -280,16 +280,20 @@ behaviac::EBTStatus HeroAgent::DoAttack()
target.Get()->GetPos().ToGlmVec3())) { target.Get()->GetPos().ToGlmVec3())) {
return behaviac::BT_FAILURE; return behaviac::BT_FAILURE;
} }
bool shot_ok = false; if (GetOwner()->dead) {
glm::vec3 shot_dir = GetOwner()->GetPos().CalcDir(target.Get()->GetPos());; return behaviac::BT_FAILURE;
GlmHelper::Normalize(shot_dir); }
GetOwner()->SetAttackDir(shot_dir); if (GetOwner()->CanShot(true)) {
if (bullet_trace_mode_) { bool shot_ok = false;
GetOwner()->Shot(shot_dir, shot_ok, 0, target.Get()->GetUniId()); glm::vec3 shot_dir = GetOwner()->GetPos().CalcDir(target.Get()->GetPos());;
} else { GlmHelper::Normalize(shot_dir);
GetOwner()->Shot(shot_dir, shot_ok, 0, target.Get()->GetUniId()); GetOwner()->SetAttackDir(shot_dir);
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());
}
} }
return behaviac::BT_RUNNING; return behaviac::BT_RUNNING;
} }
}, },