Dayz Explorer
1.29.162510
Loading...
Searching...
No Matches
hungersoundhandler.c
Go to the documentation of this file.
1
class
HungerSoundHandlerBase
extends
SoundHandlerBase
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
;
18
EffectSound
m_Sound
;
19
20
override
void
Update
()
21
{
22
if
(
m_Player
.GetMixedSoundStates() &
eMixedSoundStates
.HUNGRY )
23
{
24
ProcessSound
();
25
}
26
}
27
28
void
ProcessSound
()
29
{
30
int
currentTime =
g_Game
.GetTime();
31
if
( currentTime >
m_SoundTime
)
32
{
33
float
offset_time =
Math
.RandomFloatInclusive(
SOUND_INTERVALS_LIGHT_MIN
,
SOUND_INTERVALS_LIGHT_MAX
) * 1000;
34
m_SoundTime
= currentTime + offset_time;
35
PlaySound
();
36
}
37
}
38
39
void
PlaySound
()
40
{
41
m_Sound
=
SEffectManager
.
PlaySoundOnObject
(
"hungry_uni_Voice_Char_SoundSet"
,
m_Player
);
42
43
if
(
m_Sound
)
44
{
45
m_Sound
.SetAutodestroy(
true
);
46
}
47
else
48
{
49
Debug
.LogError(
"Missing sounset"
);
50
}
51
}
52
}
53
54
55
//---------------------------
56
// Server
57
//---------------------------
58
class
HungerSoundHandlerServer
extends
HungerSoundHandlerBase
59
{
60
61
}
m_Player
map m_Player
Debug
Definition
debug.c:2
EffectSound
Wrapper class for managing sound through SEffectManager.
Definition
effectsound.c:5
HungerSoundHandlerBase
Definition
hungersoundhandler.c:59
Math
Definition
enmath.c:7
SEffectManager
Manager class for managing Effect (EffectParticle, EffectSound).
Definition
effectmanager.c:6
SEffectManager::PlaySoundOnObject
static EffectSound PlaySoundOnObject(string sound_set, Object parent_object, float play_fade_in=0, float stop_fade_out=0, bool loop=false)
Create and play an EffectSound.
Definition
effectmanager.c:247
SoundHandlerBase
Definition
hungersoundhandler.c:2
g_Game
DayZGame g_Game
Definition
dayzgame.c:3942
Init
override Widget Init()
Definition
dayzgame.c:127
eMixedSoundStates
eMixedSoundStates
bits
Definition
emixedsoundstates.c:3
Update
override void Update()
Definition
hungersoundhandler.c:20
m_SoundTime
float m_SoundTime
Definition
hungersoundhandler.c:17
PlaySound
void PlaySound()
Definition
hungersoundhandler.c:39
SOUND_INTERVALS_LIGHT_MIN
class HungerSoundHandlerBase extends SoundHandlerBase SOUND_INTERVALS_LIGHT_MIN
SOUND_INTERVALS_LIGHT_MAX
const float SOUND_INTERVALS_LIGHT_MAX
Definition
hungersoundhandler.c:16
m_Sound
EffectSound m_Sound
Definition
hungersoundhandler.c:18
ProcessSound
void ProcessSound()
Definition
hungersoundhandler.c:28
eSoundHandlers
eSoundHandlers
Definition
playersoundmanager.c:5
m_Id
enum eStaminaZones m_Id
Daten
4_world
classes
soundhandlers
hungersoundhandler.c
Generated by
1.16.1