3 static const string PORT_DISTANCE =
"DistanceIn";
4 static const string PORT_RESULT_VECTOR =
"VectorOut";
5 static const string PORT_TARGET =
"TargetIn";
7 [
Attribute(
"10", UIWidgets.EditBox, PORT_DISTANCE)]
10 protected vector m_ResultVector;
11 protected IEntity m_Target;
14 override void OnInit(AIAgent owner)
16 if (GetVariableIn(PORT_DISTANCE, m_Distance) && (GetVariableType(
true, PORT_DISTANCE) !=
int && GetVariableType(
true, PORT_DISTANCE) !=
float) )
18 NodeError(
this, owner, PORT_DISTANCE +
" type should be number");
23 override ENodeResult EOnTaskSimulate(AIAgent owner,
float dt)
25 if (!GetVariableIn(PORT_TARGET,
m_Target))
28 AIAgent agent = AIAgent.Cast(
m_Target);
30 m_Target = agent.GetControlledEntity();
33 return ENodeResult.FAIL;
37 if (GetVariableType(
true, PORT_DISTANCE) ==
int)
40 GetVariableIn(PORT_DISTANCE,
distance);
43 else if (GetVariableType(
true, PORT_DISTANCE) ==
float)
45 GetVariableIn(PORT_DISTANCE, m_Distance);
50 vector forwardVector = pos + (
direction * m_Distance );
52 forwardVector[1] =
m_Target.GetWorld().GetSurfaceY(forwardVector[0], forwardVector[2]);
54 m_ResultVector = forwardVector;
56 SetVariableOut(PORT_RESULT_VECTOR, m_ResultVector);
58 return ENodeResult.SUCCESS;
62 protected override string GetOnHoverDescription()
64 return "It will return world position of forward vector of provided target entity multiplied by distance. If no target specified, owner will be used.";
68 override bool VisibleInPalette()
74 protected static ref TStringArray s_aVarsIn = {
78 override TStringArray GetVariablesIn()
84 protected static ref TStringArray s_aVarsOut = {
87 override TStringArray GetVariablesOut()