Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_BaseCaptureMusic.c
Go to the documentation of this file.
2 {
3  MusicManager m_MusicManager;
4 
5  //~ Delay to make sure the OnSpawn music is played correctly after the respawn menu music
6  protected void OnBaseCapture(SCR_MilitaryBaseComponent base, Faction faction)
7  {
8  PlayerController pc = GetGame().GetPlayerController();
9 
10  if (!pc)
11  return;
12 
13  SCR_ChimeraCharacter player = SCR_ChimeraCharacter.Cast(pc.GetControlledEntity());
14 
15  if (!player || player.GetFaction() != faction)
16  return;
17 
18  m_MusicManager.Play(SCR_SoundEvent.SOUND_ONBASECAPTURE);
19  }
20 
21  override void Init()
22  {
23  ChimeraWorld world = GetGame().GetWorld();
24 
25  if (!world)
26  return;
27 
28  m_MusicManager = world.GetMusicManager();
29  if (!m_MusicManager)
30  return;
31 
32  SCR_MilitaryBaseSystem baseManager = SCR_MilitaryBaseSystem.GetInstance();
33 
34  if (!baseManager)
35  return;
36 
37  baseManager.GetOnBaseFactionChanged().Insert(OnBaseCapture);
38  }
39 
40  override void OnDelete()
41  {
42  SCR_MilitaryBaseSystem baseManager = SCR_MilitaryBaseSystem.GetInstance();
43 
44  if (!baseManager)
45  return;
46 
47  baseManager.GetOnBaseFactionChanged().Remove(OnBaseCapture);
48  }
49 }
ChimeraWorld
Definition: ChimeraWorld.c:12
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
SCR_SoundEvent
Definition: SCR_SoundEvent.c:1
ScriptedMusic
Definition: ScriptedMusic.c:12
SCR_MilitaryBaseSystem
Definition: SCR_MilitaryBaseSystem.c:11
Faction
Definition: Faction.c:12
SCR_BaseCaptureMusic
Definition: SCR_BaseCaptureMusic.c:1
m_MusicManager
protected MusicManager m_MusicManager
Definition: SCR_CharacterTriggerEntity.c:70