Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
thirstsoundhandler.c
Go to the documentation of this file.
2 {
3  override void Init()
4  {
5  m_Id = eSoundHandlers.THIRST;
6  }
7 
8 }
9 
10 //---------------------------
11 // Client
12 //---------------------------
13 class ThirstSoundHandlerClient extends ThirstSoundHandlerBase
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.THIRSTY )
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_Player.PlaySoundEventEx(EPlayerSoundEventID.THIRST);
41  }
42 }
43 
44 
45 //---------------------------
46 // Server
47 //---------------------------
48 class ThirstSoundHandlerServer extends ThirstSoundHandlerBase
49 {
50 
51 }
GetGame
proto native CGame GetGame()
m_SoundTime
float m_SoundTime
Definition: thirstsoundhandler.c:17
PlaySound
void PlaySound()
Definition: thirstsoundhandler.c:38
eMixedSoundStates
eMixedSoundStates
bits
Definition: emixedsoundstates.c:2
SOUND_INTERVALS_LIGHT_MIN
class ThirstSoundHandlerBase extends SoundHandlerBase SOUND_INTERVALS_LIGHT_MIN
EffectSound
Wrapper class for managing sound through SEffectManager.
Definition: effectsound.c:4
Init
class InventoryGridController extends ScriptedWidgetEventHandler Init
Definition: uihintpanel.c:46
m_Sound
EffectSound m_Sound
Definition: thirstsoundhandler.c:18
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.
Update
override void Update()
Definition: thirstsoundhandler.c:20
eSoundHandlers
eSoundHandlers
Definition: playersoundmanager.c:4
SoundHandlerBase
Definition: hungersoundhandler.c:1
GetTime
float GetTime()
Definition: notificationsystem.c:35
ProcessSound
void ProcessSound()
Definition: thirstsoundhandler.c:28
SOUND_INTERVALS_LIGHT_MAX
const float SOUND_INTERVALS_LIGHT_MAX
Definition: thirstsoundhandler.c:16
Math
Definition: enmath.c:6
EPlayerSoundEventID
EPlayerSoundEventID
Definition: playersoundeventhandler.c:1
ThirstSoundHandlerBase
Definition: thirstsoundhandler.c:48