DayZ 1.24
Loading...
Searching...
No Matches
FreezingSoundHandler.c
Go to the documentation of this file.
1/*
2 class FreezingSoundHandlerBase extends SoundHandlerBase
3 {
4 override void Init()
5 {
6 m_Id = eSoundHandlers.FREEZING;
7 }
8
9 }
10
11 //---------------------------
12 // Client
13 //---------------------------
14 class FreezingSoundHandlerClient extends FreezingSoundHandlerBase
15 {
16 const float SOUND_INTERVALS_LIGHT_MIN = 5; const float SOUND_INTERVALS_LIGHT_MAX = 20;
17 float m_SoundTime;
18 EffectSound m_Sound;
19 ref HumanMovementState hms = new HumanMovementState();
20 override void Update()
21 {
22 if( m_Player.GetShakeLevel() > 0 )
23 {
24 ProcessSound();
25 }
26 }
27
28 void ProcessSound()
29 {
30 m_Player.GetMovementState(hms);
31 if (hms.m_iMovement == DayZPlayerConstants.MOVEMENTIDX_IDLE)
32 {
33 //return;
34 }
35
36 if( GetGame().GetTime() > m_SoundTime )
37 {
38 float offset_time = Math.RandomFloatInclusive(SOUND_INTERVALS_LIGHT_MIN, SOUND_INTERVALS_LIGHT_MAX) * 1000;
39 m_SoundTime = GetGame().GetTime() + offset_time;
40 PlaySound();
41 }
42 }
43
44 void PlaySound()
45 {
46 //Print("------------- freezing --------------");
47 m_Player.PlaySoundEvent(EPlayerSoundEventID.FREEZING);
48 }
49 }
50
51
52 //---------------------------
53 // Server
54 //---------------------------
55 class FreezingSoundHandlerServer extends HungerSoundHandlerBase
56 {
57
58 }*/