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())) {
return behaviac::BT_FAILURE;
}
bool shot_ok = false;
glm::vec3 shot_dir = GetOwner()->GetPos().CalcDir(target.Get()->GetPos());;
GlmHelper::Normalize(shot_dir);
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());
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);
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;
}
},