6 float m_fCompletionRadius;
8 [
Attribute(defvalue: EAIWaypointCompletionType.All.ToString(), UIWidgets.ComboBox,
"AI Waypoint Completion Type",
"", ParamEnumArray.FromEnum(EAIWaypointCompletionType))]
9 EAIWaypointCompletionType m_eAIWaypointCompletionType;
11 [
Attribute(
"0", UIWidgets.SpinBox,
"Waypoint priority level",
"0 2000 1000")]
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")]
15 ResourceName m_sWaypointPrefab;
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)
58 IEntity layerEntity =
GetGame().GetWorld().FindEntityByName(waypointSetLayer);
65 if (layerBases.Contains(layerBase))
68 layerChildren = layerBase.GetChildrenEntities();
87 if (slotWaypointToProcess.GetIsInitiated())
90 slotWaypointToProcess.GetOnAllChildrenSpawned().Insert(CheckWaypointsAfterInit);
93 ProcessWaypoints(
null);
102 ProcessWaypoints(
null);
104 layer.GetOnAllChildrenSpawned().Remove(CheckWaypointsAfterInit);
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)
126 m_aWaypointsWithoutCycle.SwapItems(Math.RandomInt(0, Math.Floor(wpCount * 0.5)), Math.RandomInt(Math.Ceil(wpCount * 0.5), wpCount));
130 m_CycleWaypoint.SetRerunCounter(m_iRerunCounter);
131 m_CycleWaypoint.SetWaypoints(m_aWaypointsWithoutCycle);
133 InvokeAllWaypointsSpawned();
140 if (!m_OnAllWaypointsSpawned)
141 m_OnAllWaypointsSpawned =
new ScriptInvokerBase<ScriptInvokerScenarioFrameworkLayerMethod>();
143 return m_OnAllWaypointsSpawned;
148 void InvokeAllWaypointsSpawned()
150 if (m_OnAllWaypointsSpawned && m_SlotWaypoint)
151 m_OnAllWaypointsSpawned.Invoke(m_SlotWaypoint);
155 override void SetWaypointCompletionRadius(
float radius)
157 m_fCompletionRadius = radius;
161 override float GetWaypointCompletionRadius()
163 return m_fCompletionRadius;
167 override void SetWaypointCompletionType(EAIWaypointCompletionType
type)
169 m_eAIWaypointCompletionType =
type;
173 override EAIWaypointCompletionType GetWaypointCompletionType()
175 return m_eAIWaypointCompletionType;
179 override void SetWaypointPrefab(ResourceName prefab)
181 m_sWaypointPrefab = prefab;
185 override ResourceName GetWaypointPrefab()
187 return m_sWaypointPrefab;