DayZ 1.24
Loading...
Searching...
No Matches
TriggerEffectManager Class Reference
Collaboration diagram for TriggerEffectManager:
[legend]

Private Member Functions

void TriggerEffectManager ()
 
void RegisterTriggerType (EffectTrigger effectTrigger)
 
void OnPlayerEnter (notnull PlayerBase player, notnull EffectTrigger trigger)
 
void OnPlayerInsideEffectAreaEnter (PlayerBase player)
 
void OnPlayerInsideEffectAreaExit (PlayerBase player)
 
void OnPlayerExit (notnull PlayerBase player, notnull EffectTrigger trigger)
 
bool IsPlayerInTriggerType (notnull PlayerBase player, notnull EffectTrigger trigger)
 

Static Private Member Functions

static void DestroyInstance ()
 
static TriggerEffectManager GetInstance ()
 

Private Attributes

ref map< string, ref map< PlayerBase, int > > m_PlayerInsiderMap
 

Static Private Attributes

static ref TriggerEffectManager m_This
 

Detailed Description

Definition at line 3 of file TriggerEffectManager.c.

Constructor & Destructor Documentation

◆ TriggerEffectManager()

void TriggerEffectManager::TriggerEffectManager ( )
inlineprivate

Definition at line 10 of file TriggerEffectManager.c.

11 {
13 }
ref map< string, ref map< PlayerBase, int > > m_PlayerInsiderMap

References m_PlayerInsiderMap.

Referenced by GetInstance().

Member Function Documentation

◆ DestroyInstance()

static void TriggerEffectManager::DestroyInstance ( )
inlinestaticprivate

Definition at line 15 of file TriggerEffectManager.c.

16 {
17 m_This = null;
18 }
static ref TriggerEffectManager m_This

References m_This.

Referenced by MissionBaseWorld::~MissionBase().

◆ GetInstance()

static TriggerEffectManager TriggerEffectManager::GetInstance ( )
inlinestaticprivate

Definition at line 21 of file TriggerEffectManager.c.

22 {
23 if (!m_This)
25
26 return m_This;
27 }

References m_This, and TriggerEffectManager().

Referenced by ContaminatedTrigger_Dynamic(), and EffectTrigger::EffectTrigger().

◆ IsPlayerInTriggerType()

bool TriggerEffectManager::IsPlayerInTriggerType ( notnull PlayerBase player,
notnull EffectTrigger trigger )
inlineprivate

Definition at line 112 of file TriggerEffectManager.c.

113 {
115 if (m_PlayerInsiderMap.Find(trigger.GetType(), playerMap))
116 return playerMap != null && playerMap.Contains(player);
117 return false;
118 }

References m_PlayerInsiderMap.

Referenced by EffectTrigger::SetupClientEffects().

◆ OnPlayerEnter()

void TriggerEffectManager::OnPlayerEnter ( notnull PlayerBase player,
notnull EffectTrigger trigger )
inlineprivate

Definition at line 41 of file TriggerEffectManager.c.

42 {
43 string trigger_type = trigger.GetType();
44
47 {
48 if (playerMap)
49 {
50 if (playerMap.Contains(player))
51 {
52 int newTriggerCount = playerMap.Get(player) + 1;
54 //Debug.Log("We increase the amount of triggers a player is in");
55 }
56 else
57 {
58 // First time this player enters this type of trigger, we set the trigger count to 1
59 playerMap.Insert(player, 1);
60 if (trigger.GetEffectArea())
61 trigger.GetEffectArea().OnPlayerEnterServer(player, trigger);
62 //Debug.Log("We insert a player");
63 }
64
65 //m_PlayerInsiderMap.Set( trigger_type, playerMap );
66 }
67 else
68 {
69 // We didn't have the map yet, we create it and register this player in it
71 playerMap.Insert(player, 1);
72 if (trigger.GetEffectArea())
73 trigger.GetEffectArea().OnPlayerEnterServer(player, trigger);
75 }
76 }
77 }

References m_PlayerInsiderMap.

Referenced by EffectTrigger::OnEnterClientEvent(), and EffectTrigger::OnEnterServerEvent().

◆ OnPlayerExit()

void TriggerEffectManager::OnPlayerExit ( notnull PlayerBase player,
notnull EffectTrigger trigger )
inlineprivate

Definition at line 83 of file TriggerEffectManager.c.

84 {
85 string trigger_type = trigger.GetType();
86
89 {
90 if (playerMap.Contains(player))
91 {
92 if (playerMap.Get(player) > 1)
93 {
94 //Debug.Log("We reduced the amount of triggers the player is in");
95 playerMap.Set(player, playerMap.Get(player) - 1);
96 }
97 else
98 {
99 // The player left the last trigger of this type they were in
100 playerMap.Remove(player);
101 if (trigger.GetEffectArea())
102 trigger.GetEffectArea().OnPlayerExitServer(player, trigger);
103 player.RemoveCurrentEffectTrigger();
104 //Debug.Log("We removed this player from this trigger type");
105 }
106 }
107 //m_PlayerInsiderMap.Set( trigger_type, playerMap );
108
109 }
110 }

References m_PlayerInsiderMap.

Referenced by EffectTrigger::OnLeaveClientEvent(), and EffectTrigger::OnLeaveServerEvent().

◆ OnPlayerInsideEffectAreaEnter()

void TriggerEffectManager::OnPlayerInsideEffectAreaEnter ( PlayerBase player)
private

◆ OnPlayerInsideEffectAreaExit()

void TriggerEffectManager::OnPlayerInsideEffectAreaExit ( PlayerBase player)
private

◆ RegisterTriggerType()

void TriggerEffectManager::RegisterTriggerType ( EffectTrigger effectTrigger)
inlineprivate

Definition at line 29 of file TriggerEffectManager.c.

30 {
31 if (!m_PlayerInsiderMap.Contains(effectTrigger.GetType()))
32 {
35
36 //Debug.Log( "We have : " + m_PlayerInsiderMap.Count() + " triggers");
37 }
38 }

References m_PlayerInsiderMap.

Referenced by EffectTrigger::EffectTrigger().

Member Data Documentation

◆ m_PlayerInsiderMap

ref map<string, ref map<PlayerBase, int> > TriggerEffectManager::m_PlayerInsiderMap
private

◆ m_This

ref TriggerEffectManager TriggerEffectManager::m_This
staticprivate

Definition at line 5 of file TriggerEffectManager.c.

Referenced by DestroyInstance(), and GetInstance().


The documentation for this class was generated from the following file: