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

View File

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