1
This commit is contained in:
parent
e0265b5ff4
commit
7b80205461
@ -386,6 +386,10 @@ behaviac::EBTStatus HeroAgent::DoHelpAttack(int target_uniid)
|
|||||||
target.Get()->GetPos().ToGlmVec3())) {
|
target.Get()->GetPos().ToGlmVec3())) {
|
||||||
return behaviac::BT_FAILURE;
|
return behaviac::BT_FAILURE;
|
||||||
}
|
}
|
||||||
|
float distance = target.Get()->GetPos().Distance2D2(GetOwner()->GetPos());
|
||||||
|
if (distance > GetAttackRange()) {
|
||||||
|
return behaviac::BT_FAILURE;
|
||||||
|
}
|
||||||
bool shot_ok = false;
|
bool shot_ok = false;
|
||||||
glm::vec3 shot_dir = GetOwner()->GetPos().CalcDir(target.Get()->GetPos());;
|
glm::vec3 shot_dir = GetOwner()->GetPos().CalcDir(target.Get()->GetPos());;
|
||||||
GlmHelper::Normalize(shot_dir);
|
GlmHelper::Normalize(shot_dir);
|
||||||
@ -393,7 +397,7 @@ behaviac::EBTStatus HeroAgent::DoHelpAttack(int target_uniid)
|
|||||||
if (bullet_trace_mode_) {
|
if (bullet_trace_mode_) {
|
||||||
GetOwner()->Shot(shot_dir, shot_ok, 0, target.Get()->GetUniId());
|
GetOwner()->Shot(shot_dir, shot_ok, 0, target.Get()->GetUniId());
|
||||||
} else {
|
} else {
|
||||||
GetOwner()->Shot(shot_dir, shot_ok, 0, target.Get()->GetUniId());
|
GetOwner()->Shot(shot_dir, shot_ok, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return behaviac::BT_RUNNING;
|
return behaviac::BT_RUNNING;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user