8 protected float m_fGroupMemberSpawnDelay;
11 protected bool m_bIsAtAILimit;
13 protected ref array<ref SCR_SpawnerAIRequest> m_aAIQueue;
14 protected float m_fCurrentGroupMemberSpawnDelay;
18 void SetIsAtAILimit(
bool value)
20 m_bIsAtAILimit = value;
28 return m_bIsAtAILimit;
38 void QueueSpawn(notnull SCR_CatalogEntitySpawnerComponent spawner, ResourceName resName, notnull IEntity user, notnull IEntity slotEntity, notnull SCR_EntityLabelPointComponent rallyPoint)
45 Print(
"'SCR_SpawnerAIGroupManagerComponent' resName is empty!", LogLevel.ERROR);
50 m_aAIQueue =
new array<ref SCR_SpawnerAIRequest>;
54 if (m_aAIQueue.Count() == 1)
55 SetEventMask(
GetOwner(), EntityEvent.FRAME);
61 AIWorld aiWorld =
GetGame().GetAIWorld();
62 if (!aiWorld && m_bIsAtAILimit)
64 SetIsAtAILimit(
false);
68 bool change = (aiWorld.GetCurrentAmountOfLimitedAIs() + 1) >= aiWorld.GetAILimit();
71 if (change == m_bIsAtAILimit)
74 SetIsAtAILimit(change);
78 override void EOnFrame(IEntity owner,
float timeSlice)
80 m_fCurrentGroupMemberSpawnDelay += timeSlice;
81 if (m_fCurrentGroupMemberSpawnDelay < m_fGroupMemberSpawnDelay)
86 spawnerRequest.m_Spawner.SpawnAIGroupMember(spawnerRequest.m_ResourceName, spawnerRequest.m_UserEntity, spawnerRequest.m_SlotEntity, spawnerRequest.m_RallyPoint);
87 m_aAIQueue.RemoveOrdered(0);
88 m_fCurrentGroupMemberSpawnDelay = 0;
90 if (m_aAIQueue.IsEmpty())
91 ClearEventMask(owner, EntityEvent.FRAME);
107 SetEventMask(owner, EntityEvent.INIT);
124 SCR_CatalogEntitySpawnerComponent m_Spawner;
125 ResourceName m_ResourceName;
126 IEntity m_UserEntity;
127 IEntity m_SlotEntity;
128 SCR_EntityLabelPointComponent m_RallyPoint;
137 void SCR_SpawnerAIRequest(SCR_CatalogEntitySpawnerComponent spawner, ResourceName resName, IEntity userEntity, IEntity slotEntity, SCR_EntityLabelPointComponent labelComp)
140 m_ResourceName = resName;
141 m_UserEntity = userEntity;
142 m_SlotEntity = slotEntity;
143 m_RallyPoint = labelComp;