6 float m_fCompletionRadius;
12 float m_fPriorityLevel;
14 [
Attribute(defvalue:
"{35BD6541CBB8AC08}Prefabs/AI/Waypoints/AIWaypoint_Cycle.et",
desc:
"In Default, it will use specific prefab for each class, but here you can change it if you know what you are doing")]
17 [
Attribute(defvalue:
"",
UIWidgets.EditComboBox,
desc:
"From this list, layers will be used and their waypoints processed")]
18 ref array<string> m_aLayersWithWaypointsToCycle;
20 [
Attribute(defvalue:
"-1",
desc:
"Decides how many times the cycled waypoint will run for specific group. -1 means infinite. ",
UIWidgets.Graph,
"-1 inf 1")]
24 bool m_bUseRandomOrder;
26 ref ScriptInvokerBase<ScriptInvokerScenarioFrameworkLayerMethod> m_OnAllWaypointsSpawned;
27 ref array<AIWaypoint> m_aWaypointsWithoutCycle = {};
28 ref array<SCR_ScenarioFrameworkSlotWaypoint> m_aSlotWaypoints = {};
29 AIWaypointCycle m_CycleWaypoint;
30 int m_iCurrentlySpawnedWaypoints;
34 override void SetupWaypoint(
IEntity waypointEntity)
36 super.SetupWaypoint(waypointEntity);
38 m_CycleWaypoint = AIWaypointCycle.Cast(waypointEntity);
42 array<AIWaypoint> waypointsWithoutCycle = {};
43 array<SCR_ScenarioFrameworkLayerBase> layerBases = {};
44 array<SCR_ScenarioFrameworkLayerBase> layerChildren = {};
49 if (m_aLayersWithWaypointsToCycle.IsEmpty())
53 m_aLayersWithWaypointsToCycle.Insert(layerBase.GetName());
56 foreach (
string waypointSetLayer : m_aLayersWithWaypointsToCycle)
65 if (layerBases.Contains(layerBase))
68 layerChildren = layerBase.GetChildrenEntities();
72 if (slotWaypoint && !m_aSlotWaypoints.Contains(slotWaypoint))
73 m_aSlotWaypoints.Insert(slotWaypoint);
79 if (slotWaypoint && !m_aSlotWaypoints.Contains(slotWaypoint))
80 m_aSlotWaypoints.Insert(slotWaypoint);
84 int waypointCount = m_aSlotWaypoints.Count();
87 if (slotWaypointToProcess.GetIsInitiated())
88 m_iCurrentlySpawnedWaypoints++;
92 if (waypointCount == m_iCurrentlySpawnedWaypoints)
100 m_iCurrentlySpawnedWaypoints++;
101 if (m_iCurrentlySpawnedWaypoints == m_aSlotWaypoints.Count())
115 waypoint = AIWaypoint.Cast(slotWaypoint.GetSpawnedEntity());
116 if (waypoint && !AIWaypointCycle.Cast(waypoint))
117 m_aWaypointsWithoutCycle.Insert(waypoint);
120 int wpCount = m_aWaypointsWithoutCycle.Count();
121 if (m_bUseRandomOrder && wpCount > 1)
123 foreach (AIWaypoint wp : m_aWaypointsWithoutCycle)
129 m_CycleWaypoint.SetRerunCounter(m_iRerunCounter);
130 m_CycleWaypoint.SetWaypoints(m_aWaypointsWithoutCycle);
139 for (
int i = n - 1; i > 0; i--)
141 int j =
Math.RandomInt(0, i + 1);
151 if (!m_OnAllWaypointsSpawned)
152 m_OnAllWaypointsSpawned =
new ScriptInvokerBase<ScriptInvokerScenarioFrameworkLayerMethod>();
154 return m_OnAllWaypointsSpawned;
161 if (m_OnAllWaypointsSpawned && m_SlotWaypoint)
162 m_OnAllWaypointsSpawned.Invoke(m_SlotWaypoint);
168 m_fCompletionRadius = radius;
174 return m_fCompletionRadius;
180 m_eAIWaypointCompletionType =
type;
186 return m_eAIWaypointCompletionType;
192 m_sWaypointPrefab = prefab;
198 return m_sWaypointPrefab;