3 [
Attribute(
"1", UIWidgets.CheckBox,
"Succeed when requested looking too close" )]
4 protected bool m_bSuccessWhenClose;
6 [
Attribute(
"1.5", UIWidgets.EditBox,
"Vertical offset to add to position" )]
7 protected float m_fVerticalOffset;
9 [
Attribute(
"1.5", UIWidgets.EditBox,
"DistSQ below look is ignored" )]
10 protected float m_fIgnoreLookDistSq;
12 [
Attribute(
"20", UIWidgets.EditBox,
"Priority of the look" )]
13 protected float m_fPriority;
15 protected static const string POSITION_PORT =
"PositionIn";
16 protected static const string POSITION_CORRECTION_PORT =
"PositionOut";
17 protected static const string PRIORITY_PORT =
"PriorityIn";
19 protected SCR_AIUtilityComponent m_Utility;
22 override bool VisibleInPalette() {
return true;}
25 protected static ref TStringArray s_aVarsIn = {
29 override array<string> GetVariablesIn()
34 protected static ref TStringArray s_aVarsOut = {
35 POSITION_CORRECTION_PORT
37 override array<string> GetVariablesOut()
43 override ENodeResult EOnTaskSimulate(AIAgent owner,
float dt)
50 m_Utility = SCR_AIUtilityComponent.Cast(owner.FindComponent(SCR_AIUtilityComponent));
53 NodeError(
this, owner,
"This character does not have UtilityComponent!");
54 return ENodeResult.FAIL;
58 if (!GetVariableIn(PRIORITY_PORT,priority))
61 if (!GetVariableIn(POSITION_PORT,lookPosition))
62 return ENodeResult.FAIL;
64 if (lookPosition == vector.Zero)
66 NodeError(
this,owner,
"Provided zero vector!");
67 return ENodeResult.FAIL;
70 if (!m_Utility.m_LookAction)
71 return ENodeResult.FAIL;
75 if (vector.DistanceSq(lookPosition, m_Utility.GetOrigin()) < m_fIgnoreLookDistSq)
78 ClearVariable(POSITION_CORRECTION_PORT);
79 if (m_bSuccessWhenClose)
80 return ENodeResult.SUCCESS;
82 return ENodeResult.FAIL;
85 m_Utility.m_LookAction.LookAt(lookPosition, priority);
86 SetVariableOut(POSITION_CORRECTION_PORT,lookPosition);
87 return ENodeResult.SUCCESS;
91 protected override string GetOnHoverDescription()
93 return "Look at position setter for execution inside tree LookAction.bt, the position may be corrected by terrain";