Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_HQRadioSoundEntity.c
Go to the documentation of this file.
1class SCR_HQRadioSoundEntityClass : GenericEntityClass
2{
3}
4
5class SCR_HQRadioSoundEntity : GenericEntity
6{
9
10 protected static SCR_HQRadioSoundEntity s_Instance = null;
11
12 //------------------------------------------------------------------------------------------------
14 static SCR_HQRadioSoundEntity GetInstance()
15 {
16 if (!s_Instance)
17 {
18 SCR_GameModeCampaign campaign = SCR_GameModeCampaign.GetInstance();
19 if (!campaign)
20 return null;
21
22 BaseWorld world = GetGame().GetWorld();
23
24 if (world)
25 {
26 Resource resource = Resource.Load(campaign.GetHQRadioSoundEntityPrefab());
27 if (!resource || !resource.IsValid())
28 return null;
29
30 s_Instance = SCR_HQRadioSoundEntity.Cast(GetGame().SpawnEntityPrefab(resource, world));
31 }
32 }
33
34 return s_Instance;
35 }
36
37 //------------------------------------------------------------------------------------------------
40 void PlayRadioSound(string soundEventName)
41 {
42 AudioSystem.TerminateSound(m_PlayedRadio);
43 m_PlayedRadio = m_SimpleSoundComponent.PlayStr(soundEventName);
44
45 #ifdef ENABLE_DIAG
46 if (m_PlayedRadio == AudioHandle.Invalid)
47 Print("[SCR_HQRadioSoundEntity.PlayRadioSound] soundEventName:"+soundEventName+" not configured.", LogLevel.WARNING);
48 #endif
49 }
50
51 //------------------------------------------------------------------------------------------------
59
60 //------------------------------------------------------------------------------------------------
61 // destructor
63 {
64 s_Instance = null;
65 }
66}
ArmaReforgerScripted GetGame()
Definition game.c:1398
void SCR_GameModeCampaign(IEntitySource src, IEntity parent)
AudioHandle m_PlayedRadio
SimpleSoundComponent GetSimpleSoundComponent()
void ~SCR_HQRadioSoundEntity()
void PlayRadioSound(string soundEventName)
SCR_HQRadioSoundEntityClass m_SimpleSoundComponent
Object holding reference to resource. In destructor release the resource.
Definition Resource.c:25
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
LogLevel
Enum with severity of the logging message.
Definition LogLevel.c:14