Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_EnterEnemyMilitaryBaseMusic.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 OnBaseEntered(notnull SCR_CampaignMilitaryBaseComponent base)
7  {
8  Faction playerFaction;
9  SCR_FactionManager factionManager = SCR_FactionManager.Cast(GetGame().GetFactionManager());
10  if (factionManager)
11  playerFaction = factionManager.GetLocalPlayerFaction();
12 
13  if (base.GetFaction() == playerFaction)
14  return;
15 
16  m_MusicManager.Play(SCR_SoundEvent.SOUND_ONENTERINGENEMYBASE);
17  }
18 
19  override void Init()
20  {
21  ChimeraWorld world = GetGame().GetWorld();
22 
23  if (!world)
24  return;
25 
26  m_MusicManager = world.GetMusicManager();
27 
28  if (!m_MusicManager)
29  return;
30 
31  SCR_GameModeCampaign campaign = SCR_GameModeCampaign.GetInstance();
32 
33  if (!campaign)
34  return;
35 
36  SCR_CampaignMilitaryBaseManager baseManager = campaign.GetBaseManager();
37 
38  if (!baseManager)
39  return;
40 
41  baseManager.GetOnLocalPlayerEnteredBase().Insert(OnBaseEntered);
42  }
43 
44  override void OnDelete()
45  {
46  SCR_GameModeCampaign campaign = SCR_GameModeCampaign.GetInstance();
47 
48  if (!campaign)
49  return;
50 
51  SCR_CampaignMilitaryBaseManager baseManager = campaign.GetBaseManager();
52 
53  if (!baseManager)
54  return;
55 
56  baseManager.GetOnLocalPlayerEnteredBase().Remove(OnBaseEntered);
57  }
58 }
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_GameModeCampaign
void SCR_GameModeCampaign(IEntitySource src, IEntity parent)
Definition: SCR_GameModeCampaign.c:1927
SCR_EnterEnemyMilitaryBaseMusic
Definition: SCR_EnterEnemyMilitaryBaseMusic.c:1
Faction
Definition: Faction.c:12
SCR_CampaignMilitaryBaseManager
Created in SCR_GameModeCampaign.
Definition: SCR_CampaignMilitaryBaseManager.c:21
SCR_FactionManager
void SCR_FactionManager(IEntitySource src, IEntity parent)
Definition: SCR_FactionManager.c:461
m_MusicManager
protected MusicManager m_MusicManager
Definition: SCR_CharacterTriggerEntity.c:70
SCR_CampaignMilitaryBaseComponent
Definition: SCR_CampaignMilitaryBaseComponent.c:38