DayZ 1.24
Loading...
Searching...
No Matches
InfectedSoundEventHandler.c
Go to the documentation of this file.
13
15{
20
22 {
26 m_AvailableStates[EInfectedSoundEventID.MINDSTATE_DISTURBED_IDLE] = new DisturbedIdleSoundEvent();
27 //m_AvailableStates[EInfectedSoundEventID.MINDSTATE_CHASE_IDLE] = new ChaseIdleSoundEvent();
30 m_AvailableStates[EInfectedSoundEventID.MINDSTATE_ALERTED_MOVE] = new AlertedMoveSoundEvent();
31 }
32
33 override static int GetSoundEventType(int id)
34 {
35 return m_AvailableStates[id].GetSoundEventType();
36 }
37
39 {
41 return m_CurrentState.GetSoundEventID();
42 return -1;
43 }
44
46 {
48 return m_CurrentState.GetSoundEventType();
49 return -1;
50 }
51
52 void Stop()
53 {
55 m_CurrentState.Stop();
56 }
57
58 void SoftStop()
59 {
61 m_CurrentState.SoftStop();
62 }
63
64 bool IsPlaying()
65 {
66 if (m_CurrentState && m_CurrentState.IsSoundCallbackExist())
67 return true;
68
69 return false;
70 }
71
72 override bool PlayRequest(int id, bool sent_from_server = false)
73 {
75
76 if (!requested_state.CanPlay())
77 return false;
78
80 {
81 if (!m_CurrentState.IsSoundCallbackExist())
82 {
83 //Print("Missing callback - cleanup and continue");
84 delete m_CurrentState;
85 }
86
88 if (GetCurrentStateEventID() == id)
89 {
90 //Print("Same ID - skipping");
91 return false;
92 }
93 }
94
96 {
97 m_CurrentState.SoftStop();
98 m_CurrentState = InfectedSoundEventBase.Cast(requested_state.ClassName().ToType().Spawn());
100 m_CurrentState.Play();
101 return true;
102 }
103 else
104 {
105 m_CurrentState = InfectedSoundEventBase.Cast(requested_state.ClassName().ToType().Spawn());
107 m_CurrentState.Play();
108 return true;
109 }
110
111 return false;//should never get here
112 }
113}
void Stop()
Stops all elements this effect consists of.
Definition Effect.c:175
bool IsPlaying()
Returns true when the Effect is playing, false otherwise.
Definition Effect.c:189
enum EInfectedSoundEventType m_Infected
void SoftStop()
void InfectedSoundEventHandler(ZombieBase pInfected)
@ MINDSTATE_ALERTED_MOVE
@ MINDSTATE_DISTURBED_IDLE
@ MINDSTATE_CHASE_MOVE
@ MINDSTATE_ALERTED_IDLE
@ MINDSTATE_CALM_IDLE
@ MINDSTATE_CALM_MOVE
ref InfectedSoundEventBase m_CurrentState
static ref InfectedSoundEventBase m_AvailableStates[SOUND_EVENTS_MAX]
override int GetCurrentStateEventID()
enum EInfectedSoundEventID SOUND_EVENTS_MAX
override int GetCurrentStateEventType()
class MindStateSoundEventBase extends InfectedSoundEventBase CalmIdleSoundEvent()
Definition MindStates.c:13
void ChaseMoveSoundEvent()
Definition MindStates.c:54
class ChaseMoveSoundEvent extends MindStateSoundEventBase AlertedIdleSoundEvent()
Definition MindStates.c:53
class CalmMoveSoundEvent extends MindStateSoundEventBase DisturbedIdleSoundEvent()
Definition MindStates.c:33
void CalmMoveSoundEvent()
Definition MindStates.c:34
EAnimPlayState PlayRequest()
int GetSoundEventType()