Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
anniversarymusicsource.c
Go to the documentation of this file.
2 {
6 }
7 
8 class AnniversaryMusicSource : Building
9 {
10  private const string SOUND_INTENSE = "AnniversaryMusic_Intense_SoundSet";
11  private const string SOUND_LIGHT = "AnniversaryMusic_Light_SoundSet";
12 
13  #ifndef SERVER
16  #endif
17 
18  protected int m_MusicState;
19  protected int m_MusicStateLocal;
20 
22  {
25 
26  RegisterNetSyncVariableInt("m_MusicState", 0, EnumTools.GetEnumSize(EAnniversaryMusicStates));
27  }
28 
29  override void EEDelete(EntityAI parent)
30  {
31  super.EEDelete(parent);
32 
33  #ifndef SERVER
35  SEffectManager.DestroyEffect(m_LightAmbientSound);
36 
39  #endif
40  }
41 
42  override void OnVariablesSynchronized()
43  {
44  super.OnVariablesSynchronized();
45 
47  {
49  #ifndef SERVER
50  UpdateMusic();
51  #endif
52  }
53  }
54 
55  void UpdateMusic()
56  {
57  #ifndef SERVER
59  m_IntenseAmbientSound = SEffectManager.CreateSound(SOUND_INTENSE, GetPosition(), 0.5, 0.5, false);
60 
62  m_LightAmbientSound = SEffectManager.CreateSound(SOUND_LIGHT, GetPosition(), 0.5, 0.5, true);
63  #endif
64 
65  switch (m_MusicState)
66  {
67  case EAnniversaryMusicStates.LIGHT:
68  PlayLight();
69  break;
70 
71  case EAnniversaryMusicStates.INTENSE:
72  PlayIntense();
73  break;
74 
75  default:
76  StopAllMusic();
77  break;
78  }
79  }
80 
81  //just sync
83  {
85  SetSynchDirty();
86  }
87 
88  //just sync
90  {
92  SetSynchDirty();
93  }
94 
95  //just sync
97  {
99  SetSynchDirty();
100  }
101 
102  void PlayIntense()
103  {
104  #ifndef SERVER
105  m_LightAmbientSound.SoundStop();
106  m_IntenseAmbientSound.SoundPlay();
107  #endif
108  }
109 
110  void PlayLight()
111  {
112  #ifndef SERVER
113  m_IntenseAmbientSound.SoundStop();
114  m_LightAmbientSound.SoundPlay();
115  #endif
116  }
117 
119  {
120  #ifndef SERVER
121  m_IntenseAmbientSound.SoundStop();
122  m_LightAmbientSound.SoundStop();
123  #endif
124  }
125 }
m_MusicState
protected int m_MusicState
Definition: anniversarymusicsource.c:18
SOUND_LIGHT
const private string SOUND_LIGHT
Definition: anniversarymusicsource.c:11
m_MusicStateLocal
protected int m_MusicStateLocal
Definition: anniversarymusicsource.c:19
EEDelete
override void EEDelete(EntityAI parent)
Definition: anniversarymusicsource.c:29
EAnniversaryMusicStates
EAnniversaryMusicStates
Definition: anniversarymusicsource.c:1
SOUND_INTENSE
enum EAnniversaryMusicStates SOUND_INTENSE
StopAllMusic
void StopAllMusic()
Definition: anniversarymusicsource.c:118
AnniversaryMusicSource
void AnniversaryMusicSource()
Definition: anniversarymusicsource.c:21
INTENSE
@ INTENSE
Definition: anniversarymusicsource.c:5
OnVariablesSynchronized
override void OnVariablesSynchronized()
Definition: anniversarymusicsource.c:42
SetLightServer
void SetLightServer()
Definition: anniversarymusicsource.c:89
UpdateMusic
void UpdateMusic()
Definition: anniversarymusicsource.c:55
LIGHT
@ LIGHT
Definition: anniversarymusicsource.c:4
INVALID
@ INVALID
Definition: anniversarymusicsource.c:3
GetPosition
class JsonUndergroundAreaTriggerData GetPosition
Definition: undergroundarealoader.c:9
SetIntenseServer
void SetIntenseServer()
Definition: anniversarymusicsource.c:82
EffectSound
Wrapper class for managing sound through SEffectManager.
Definition: effectsound.c:4
PlayLight
void PlayLight()
Definition: anniversarymusicsource.c:110
m_IntenseAmbientSound
protected EffectSound m_IntenseAmbientSound
Definition: anniversarymusicsource.c:15
EnumTools
Definition: enconvert.c:589
m_LightAmbientSound
protected EffectSound m_LightAmbientSound
Definition: anniversarymusicsource.c:14
PlayIntense
void PlayIntense()
Definition: anniversarymusicsource.c:102
SEffectManager
Manager class for managing Effect (EffectParticle, EffectSound)
Definition: effectmanager.c:5
EntityAI
Definition: building.c:5
SetInvalidServer
void SetInvalidServer()
Definition: anniversarymusicsource.c:96