3 static const string SMART_ACTION_GUARD_PORT =
"SmartActionGuard";
4 static const string POSITION_PORT =
"OutPos";
5 static const string LOOK_DIRECTION_PORT =
"LookPosition";
6 static const string LOOK_DIRECTION_RANGE_PORT =
"LookDirectionRange";
7 static const string STANCE_PORT =
"Stance";
8 static const string USE_BINOCULARS_PORT =
"UseBinoculars";
9 static const string LEANING_PORT =
"LeaningType";
11 protected override bool VisibleInPalette()
17 protected static ref TStringArray s_aVarsIn = {
18 SMART_ACTION_GUARD_PORT
20 override TStringArray GetVariablesIn()
26 protected static ref TStringArray s_aVarsOut = {
29 LOOK_DIRECTION_RANGE_PORT,
34 override TStringArray GetVariablesOut()
40 override ENodeResult EOnTaskSimulate(AIAgent owner,
float dt)
42 SCR_AISmartActionSentinelComponent smartAction;
43 if(!GetVariableIn(SMART_ACTION_GUARD_PORT, smartAction) || !smartAction)
45 NodeError(
this, owner,
"Invalid SCR_AISmartActionSentinelComponent provided!");
46 return ENodeResult.FAIL;
49 vector worldPosition = smartAction.GetActionOffset(), worldPositionToLook = smartAction.GetLookPosition(), smartObjectPos = smartAction.m_Owner.GetOrigin();
51 smartAction.m_Owner.GetWorldTransform(mat);
52 worldPosition = smartObjectPos + worldPosition.Multiply3(mat);
53 if (worldPositionToLook == vector.Zero)
54 worldPositionToLook = smartObjectPos + (10 * vector.Forward).Multiply3(mat);
56 worldPositionToLook = smartObjectPos + worldPositionToLook.Multiply3(mat);
58 SetVariableOut(POSITION_PORT, worldPosition);
59 SetVariableOut(LOOK_DIRECTION_PORT, worldPositionToLook);
60 SetVariableOut(LOOK_DIRECTION_RANGE_PORT, smartAction.GetLookDirectionRange());
61 SetVariableOut(STANCE_PORT, smartAction.GetDesiredStance());
62 SetVariableOut(USE_BINOCULARS_PORT, smartAction.GetUseBinoculars());
63 switch (smartAction.GetLeaningType())
65 case ELeaningType.LEFT :
67 SetVariableOut(LEANING_PORT,
"CharacterLeanToggleLeft");
70 case ELeaningType.RIGHT :
72 SetVariableOut(LEANING_PORT,
"CharacterLeanToggleRight");
77 ClearVariable(LEANING_PORT);
80 return ENodeResult.SUCCESS;