Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_DeathMusic.c
Go to the documentation of this file.
2 {
3  MusicManager m_MusicManager;
4 
5  //~ When the player died
6  protected void OnPlayerDied(int playerId, IEntity playerEntity, IEntity killerEntity, notnull Instigator killer)
7  {
8  if (playerId != SCR_PlayerController.GetLocalPlayerId())
9  return;
10 
11  m_MusicManager.Play(SCR_SoundEvent.SOUND_ONDEATH);
12  }
13 
14  override void Init()
15  {
16  ChimeraWorld world = GetGame().GetWorld();
17 
18  if (!world)
19  return;
20 
21  m_MusicManager = world.GetMusicManager();
22  if (!m_MusicManager)
23  return;
24 
25  //~ On player spawned and died register
27  if (gameMode)
28  {
29  gameMode.GetOnPlayerKilled().Insert(OnPlayerDied);
30  }
31 
32  }
33 
34  override void OnDelete()
35  {
37  if (gameMode)
38  {
39  gameMode.GetOnPlayerKilled().Remove(OnPlayerDied);
40  }
41  }
42 }
ChimeraWorld
Definition: ChimeraWorld.c:12
SCR_BaseGameMode
Definition: SCR_BaseGameMode.c:137
SCR_PlayerController
Definition: SCR_PlayerController.c:31
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
SCR_SoundEvent
Definition: SCR_SoundEvent.c:1
ScriptedMusic
Definition: ScriptedMusic.c:12
Instigator
Definition: Instigator.c:6
GetGameMode
SCR_BaseGameMode GetGameMode()
Definition: SCR_BaseGameModeComponent.c:15
SCR_DeathMusic
Definition: SCR_DeathMusic.c:1
m_MusicManager
protected MusicManager m_MusicManager
Definition: SCR_CharacterTriggerEntity.c:70