3 protected static const string PORT_IDLE_DURATION =
"IdleDuration";
5 protected SCR_AIUtilityComponent m_Utility;
7 protected static ref TStringArray s_aVarsOut = { PORT_IDLE_DURATION };
8 override TStringArray GetVariablesOut()
13 override bool VisibleInPalette()
18 override string GetOnHoverDescription()
20 return "Returns how many seconds the soldier should stay in cover";
23 override void OnInit(AIAgent owner)
25 m_Utility = SCR_AIUtilityComponent.Cast(owner.FindComponent(SCR_AIUtilityComponent));
27 NodeError(
this, owner,
"Utility component not found");
30 override ENodeResult EOnTaskSimulate(AIAgent owner,
float dt)
33 return ENodeResult.FAIL;
35 EAIThreatState threat = m_Utility.m_ThreatSystem.GetState();
39 case EAIThreatState.SAFE:
40 case EAIThreatState.VIGILANT: duration = Math.RandomFloat(2.0, 4.0);
break;
41 case EAIThreatState.ALERTED: duration = Math.RandomFloat(7.0, 11.0);
break;
42 case EAIThreatState.THREATENED: duration = Math.RandomFloat(11.0, 16.0);
break;
44 SetVariableOut(PORT_IDLE_DURATION, duration);
45 return ENodeResult.SUCCESS;