Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_SpawnPositionComponentManager.c
Go to the documentation of this file.
1[EntityEditorProps(insertable: false)]
2class SCR_SpawnPositionComponentManagerClass : GenericEntityClass
3{
4}
5
6class SCR_SpawnPositionComponentManager : GenericEntity
7{
8 protected static SCR_SpawnPositionComponentManager s_Instance;
9 protected ref array<SCR_SpawnPositionComponent> m_aSpawnPositions;
10
11 //------------------------------------------------------------------------------------------------
14 static SCR_SpawnPositionComponentManager GetInstance(bool createNew = true)
15 {
16 if (!s_Instance && createNew)
17 s_Instance = SCR_SpawnPositionComponentManager.Cast(GetGame().SpawnEntity(SCR_SpawnPositionComponentManager, GetGame().GetWorld()));
18
19 return s_Instance;
20 }
21
22 //------------------------------------------------------------------------------------------------
25 void AddSpawnPosition(SCR_SpawnPositionComponent positionComp)
26 {
29
30 if (!m_aSpawnPositions.Contains(positionComp))
31 m_aSpawnPositions.Insert(positionComp);
32 }
33
34 //------------------------------------------------------------------------------------------------
37 void DeleteSpawnPosition(SCR_SpawnPositionComponent positionComp)
38 {
40 return;
41
42 m_aSpawnPositions.RemoveItem(positionComp);
43
44 if (m_aSpawnPositions.IsEmpty())
45 m_aSpawnPositions = null;
46 }
47
48 //------------------------------------------------------------------------------------------------
53 int GetSpawnPositionsInRange(vector center, float range, out array<SCR_SpawnPositionComponent> positions)
54 {
56 return 0;
57
58 float rangeSq = range * range;
59 foreach (SCR_SpawnPositionComponent position : m_aSpawnPositions)
60 {
61 if (vector.DistanceSq(position.GetOwner().GetOrigin(), center) <= rangeSq)
62 positions.Insert(position);
63 }
64
65 return positions.Count();
66 }
67
68 //------------------------------------------------------------------------------------------------
69 // destructor
71 {
72 if (s_Instance == this)
73 s_Instance = null;
74 }
75}
ArmaReforgerScripted GetGame()
Definition game.c:1398
IEntity SpawnEntity(ResourceName entityResourceName, notnull IEntity slotOwner)
enum SCR_ECompassType EntityEditorProps(category:"GameScripted/Gadgets", description:"Compass", color:"0 0 255 255")
Prefab data class for compass component.
vector position
ref array< SCR_SpawnPositionComponent > m_aSpawnPositions
int GetSpawnPositionsInRange(vector center, float range, out array< SCR_SpawnPositionComponent > positions)
void AddSpawnPosition(SCR_SpawnPositionComponent positionComp)
void DeleteSpawnPosition(SCR_SpawnPositionComponent positionComp)
void ~SCR_SpawnPositionComponentManager()