File size: 996 Bytes
24b81cb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
class ThirstSoundHandlerBase extends SoundHandlerBase
{
	override void Init()
	{
		m_Id = eSoundHandlers.THIRST;
	}
	
}

//---------------------------
// Client
//---------------------------
class ThirstSoundHandlerClient extends ThirstSoundHandlerBase
{
	const float SOUND_INTERVALS_LIGHT_MIN = 10;
	const float SOUND_INTERVALS_LIGHT_MAX = 30;
	float m_SoundTime;
	EffectSound m_Sound;
	
	override void Update()
	{
		if ( m_Player.GetMixedSoundStates() & eMixedSoundStates.THIRSTY )
		{
			ProcessSound();
		}
	}
	
	void ProcessSound()
	{
		if ( GetGame().GetTime() > m_SoundTime)
		{
			float offset_time = Math.RandomFloatInclusive(SOUND_INTERVALS_LIGHT_MIN, SOUND_INTERVALS_LIGHT_MAX) * 1000;
			m_SoundTime = GetGame().GetTime() + offset_time;
			PlaySound();
		}
	}
	
	void PlaySound()
	{
		m_Player.PlaySoundEventEx(EPlayerSoundEventID.THIRST);
	}
}


//---------------------------
// Server
//---------------------------
class ThirstSoundHandlerServer extends ThirstSoundHandlerBase
{
	
}