This commit is contained in:
aozhiwei 2023-08-16 17:24:22 +08:00
parent 60fb279830
commit 06ff506672
2 changed files with 15 additions and 8 deletions

View File

@ -13,13 +13,20 @@
<property ResultOption="BT_INVALID" />
</node>
</node>
<node class="Action" id="5">
<property Method="Self.BaseAgent::CoShot()" />
<property ResultOption="BT_INVALID" />
</node>
<node class="Action" id="2">
<property Method="Self.BaseAgent::CoMoveToCurrentTarget(60)" />
<property ResultOption="BT_INVALID" />
<node class="IfElse" id="6">
<node class="Condition" id="7">
<property Operator="Greater" />
<property Opl="Self.BaseAgent::GetAttackRange()" />
<property Opr="Self.BaseAgent::GetCurrentTargetDistance()" />
</node>
<node class="Action" id="5">
<property Method="Self.BaseAgent::CoShot()" />
<property ResultOption="BT_INVALID" />
</node>
<node class="Action" id="2">
<property Method="Self.BaseAgent::CoMoveToCurrentTarget(60)" />
<property ResultOption="BT_INVALID" />
</node>
</node>
</node>
</behavior>

View File

@ -511,7 +511,7 @@ behaviac::EBTStatus BaseAgent::CoShot()
return behaviac::BT_FAILURE;
}
glm::vec3 dir = GetOwner()->GetPos().CalcDir(current_target_.Get()->GetPos());
if (GlmHelper::Norm(dir) > 150) {
if (GlmHelper::Norm(dir) > GetAttackRange()) {
return behaviac::BT_FAILURE;
}
bool shot_ok = false;