Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
hungersoundhandler.c
Go to the documentation of this file.
2 {
3  override void Init()
4  {
5  m_Id = eSoundHandlers.HUNGER;
6  }
7 
8 }
9 
10 //---------------------------
11 // Client
12 //---------------------------
13 class HungerSoundHandlerClient extends HungerSoundHandlerBase
14 {
15  const float SOUND_INTERVALS_LIGHT_MIN = 10;
16  const float SOUND_INTERVALS_LIGHT_MAX = 30;
17  float m_SoundTime;
19 
20  override void Update()
21  {
22  if ( m_Player.GetMixedSoundStates() & eMixedSoundStates.HUNGRY )
23  {
24  ProcessSound();
25  }
26  }
27 
28  void ProcessSound()
29  {
30  if ( GetGame().GetTime() > m_SoundTime)
31  {
32  float offset_time = Math.RandomFloatInclusive(SOUND_INTERVALS_LIGHT_MIN, SOUND_INTERVALS_LIGHT_MAX) * 1000;
33  m_SoundTime = GetGame().GetTime() + offset_time;
34  PlaySound();
35  }
36  }
37 
38  void PlaySound()
39  {
40  m_Sound = SEffectManager.PlaySoundOnObject("hungry_uni_Voice_Char_SoundSet", m_Player);
41 
42  if( m_Sound )
43  {
44  m_Sound.SetAutodestroy(true);
45  }
46  else
47  {
48  Debug.LogError("Missing sounset");
49  }
50  }
51 }
52 
53 
54 //---------------------------
55 // Server
56 //---------------------------
57 class HungerSoundHandlerServer extends HungerSoundHandlerBase
58 {
59 
60 }
GetGame
proto native CGame GetGame()
m_Sound
EffectSound m_Sound
Definition: hungersoundhandler.c:18
ProcessSound
void ProcessSound()
Definition: hungersoundhandler.c:28
eMixedSoundStates
eMixedSoundStates
bits
Definition: emixedsoundstates.c:2
EffectSound
Wrapper class for managing sound through SEffectManager.
Definition: effectsound.c:4
Init
class InventoryGridController extends ScriptedWidgetEventHandler Init
Definition: uihintpanel.c:46
m_Player
DayZPlayer m_Player
Definition: hand_events.c:42
m_Id
class GetServerModListResult m_Id
GetServersResultRow the output structure of the GetServers operation that represents one game server.
SOUND_INTERVALS_LIGHT_MIN
class HungerSoundHandlerBase extends SoundHandlerBase SOUND_INTERVALS_LIGHT_MIN
Update
override void Update()
Definition: hungersoundhandler.c:20
eSoundHandlers
eSoundHandlers
Definition: playersoundmanager.c:4
m_SoundTime
float m_SoundTime
Definition: hungersoundhandler.c:17
Debug
Definition: debug.c:13
SoundHandlerBase
Definition: hungersoundhandler.c:1
HungerSoundHandlerBase
Definition: hungersoundhandler.c:57
PlaySound
void PlaySound()
Definition: hungersoundhandler.c:38
GetTime
float GetTime()
Definition: notificationsystem.c:35
Math
Definition: enmath.c:6
SEffectManager
Manager class for managing Effect (EffectParticle, EffectSound)
Definition: effectmanager.c:5
SOUND_INTERVALS_LIGHT_MAX
const float SOUND_INTERVALS_LIGHT_MAX
Definition: hungersoundhandler.c:16