4 static const int LOD_MAX = 10;
5 static const int LOD_COUNT = LOD_MAX + 1;
6 static float s_aUpdateIntervals[LOD_COUNT] = {
21 protected static string PORT_UNKNOWN_TARGET =
"UnknownTarget";
24 protected static string PORT_BEHAVIOR_TREE =
"BehaviorTree";
25 protected static string PORT_UPDATE_BEHAVIOR =
"UpdateBehavior";
26 protected static string PORT_USE_COMBAT_MOVE =
"UseCombatMove";
27 protected static string PORT_UPDATE_INTERVAL =
"UpdateInterval";
31 protected SCR_AIUtilityComponent m_UtilityComponent;
33 protected float m_fRandomDelay_s;
36 override void OnInit(AIAgent owner)
38 m_UtilityComponent = SCR_AIUtilityComponent.Cast(owner.FindComponent(SCR_AIUtilityComponent));
39 if (!m_UtilityComponent)
41 NodeError(
this, owner,
"Can't find utility component.");
44 m_fRandomDelay_s = Math.RandomFloat(0.0, s_aUpdateIntervals[0]);
48 override ENodeResult EOnTaskSimulate(AIAgent owner,
float dt)
50 if (!m_UtilityComponent)
51 return ENodeResult.FAIL;
54 GetVariableIn(PORT_UNKNOWN_TARGET, unknownTarget);
59 Print(
"AI: Missing behavior tree in " +
m_CurrentBehavior.ToString(), LogLevel.WARNING);
60 return ENodeResult.FAIL;
66 SetVariableOut(PORT_UPDATE_BEHAVIOR,
true);
73 int lod = Math.ClampInt(owner.GetLOD(), 0, LOD_MAX);
74 float updateInterval = s_aUpdateIntervals[lod] + m_fRandomDelay_s;
75 SetVariableOut(PORT_UPDATE_INTERVAL, updateInterval);
79 return ENodeResult.SUCCESS;
83 protected static ref TStringArray s_aVarsOut = {
89 override TStringArray GetVariablesOut()
95 protected static ref TStringArray s_aVarsIn = {
98 override TStringArray GetVariablesIn()
104 override bool VisibleInPalette() {
return true;}