Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
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 {
9 if (!campaignBase || campaignBase.GetBuiltByPlayers())
10 return;
11
12 PlayerController pc = GetGame().GetPlayerController();
13
14 if (!pc)
15 return;
16
17 SCR_ChimeraCharacter player = SCR_ChimeraCharacter.Cast(pc.GetControlledEntity());
18
19 if (!player || player.GetFaction() != faction)
20 return;
21
22 m_MusicManager.Play(SCR_SoundEvent.SOUND_ONBASECAPTURE);
23 }
24
25 override void Init()
26 {
27 ChimeraWorld world = GetGame().GetWorld();
28
29 if (!world)
30 return;
31
32 m_MusicManager = world.GetMusicManager();
33 if (!m_MusicManager)
34 return;
35
37
38 if (!baseManager)
39 return;
40
41 baseManager.GetOnBaseFactionChanged().Insert(OnBaseCapture);
42 }
43
44 override void OnDelete()
45 {
47
48 if (!baseManager)
49 return;
50
51 baseManager.GetOnBaseFactionChanged().Remove(OnBaseCapture);
52 }
53}
ArmaReforgerScripted GetGame()
Definition game.c:1398
void OnBaseCapture(SCR_MilitaryBaseComponent base, Faction faction)
OnBaseFactionChangedInvoker GetOnBaseFactionChanged()
static SCR_MilitaryBaseSystem GetInstance()