DayZ 1.29
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
PlayerSoundEventBase.c
См. документацию.
2{
3 GENERAL = 0x00000001,
4 MELEE = 0x00000002,
5 STAMINA = 0x00000004,
6 DAMAGE = 0x00000008,
7 DUMMY = 0x00000010,
8 INJURY = 0x00000020,
9 DROWNING = 0x00000040,
10 //HEAT_COMFORT = 0x00000080,
11}
12
13enum EPlayerSoundEventParam
14{
16 HIGHEST_PRIORITY = 0x00000002,
17 STOP_PLAYBACK = 0x00000004,
18 /*
19 STAMINA = 0x00000004,
20 DAMAGE = 0x00000008,
21 DUMMY = 0x00000010,
22 INJURY = 0x00000020,
23 HEAT_COMFORT = 0x00000040,
24 */
25
26 // ONLY COUNT BELLOW
28
29}
30
32{
39
42
43 bool IsDummy()
44 {
45 return m_IsDummyType;
46 }
47
52
53 // !can this event play during hold breath
55 {
56 return false;
57 }
58
60 {
62 }
63
65 {
67 OnEnd();
68 }
69
74
76 {
77 return true;
78 }
79
81 {
82 if(IsDummy())
83 {
84 return IsDummyFinished();
85 }
86 else
87 {
88 return !IsSoundCallbackExist();
89 }
90 }
91
93 {
94 return g_Game.GetTime() > (m_DummyStartTime + m_DummySoundLength);
95 }
96
97
98 void OnTick(float delta_time)
99 {
100 if ( m_SoundSetCallback )
101 {
102 m_SoundSetCallback.SetPosition(m_Player.GetPosition());
103 //---------- Playback event -------------
104 if( delta_time > 0 && m_ProcessPlaybackEvent )//delta_time 0 is for remotes
105 {
106
107 m_PlayTime += delta_time;
108 //this is not 100% precise as the playback position is not obtained from the sound system
109 float playback01 = Math.Clamp(m_PlayTime / m_SoundSetCallback.GetLength(),0,1);
110 SendEvent(playback01);
111 //---------- Playback event -------------
112 }
113 }
114 }
115
116 bool CanPlay(PlayerBase player)
117 {
118 player.GetMovementState(m_Hms);
119
120 if (player.IsHoldingBreath() && !HasHoldBreathException())
121 {
122 return false;
123 }
124 if (player.m_IsDrowning || (player.IsSwimming() && m_Hms.m_iMovement != 0))
125 {
126 return false;
127 }
128 return true;
129 }
130
131 void Init(PlayerBase player)
132 {
133 InitEx(player,0);
134 }
135
136 void InitEx(PlayerBase player, int param)
137 {
138 m_Player = player;
139 m_Param = param;
140 if (param & EPlayerSoundEventParam.HIGHEST_PRIORITY)
141 {
143 }
144 }
145
146 void OnEnd()
147 {
149 SendEvent(1);
150 }
151
152 void SendEvent(float time)
153 {
154 if(m_PlayTime < 0 || !m_SoundSetCallback)//negative m_PlayTime value indicates the event has already been sent for playback01 = 1
155 return;
156
157 m_Player.OnVoiceEventPlayback(this, m_SoundSetCallback, time);
158 if(time >= 1)
159 m_PlayTime = -float.MAX;
160 }
161
163 {
164
165 }
166
167 override void OnPlay(PlayerBase player)
168 {
169 super.OnPlay(player);
170 //Print("start playing -------------------->" + m_Type);
171 player.OnVoiceEvent(this);
172 //m_Player.OnVoiceEventDuration(m_SoundSetCallback, 0);
173 }
174
175 override bool Play()
176 {
177 if(!super.Play())
178 return false;
179
180 if( !IsDummy() )
181 {
182 m_SoundSetCallback = m_Player.ProcessVoiceEvent("","", m_SoundVoiceAnimEventClassID);
183
185 {
186 AbstractWaveEvents events = AbstractWaveEvents.Cast(m_SoundSetCallback.GetUserData());
189 return true;
190 }
191 else
192 return false;
193 }
194 else
195 {
196 m_DummyStartTime = g_Game.GetTime();
197 return true;
198 }
199 return false;
200
201 }
202}
eBleedingSourceType m_Type
map m_Player
DayZGame g_Game
Определения DayZGame.c:3942
override Widget Init()
Определения DayZGame.c:127
override bool HasHoldBreathException()
Определения HoldBreathEvents.c:24
@ MELEE
Определения ImpactEffects.c:7
@ GENERAL
Определения InfectedSoundEventBase.c:3
@ ENUM_COUNT
Определения InfectedSoundEventHandler.c:11
override bool CanPlay()
Определения MindStates.c:16
void OnTick(PlayerBase player, float deltaT)
Определения HeavyMetal.c:219
EPlayerSoundEventType GetPriorityOverTypes()
Определения PlayerSoundEventBase.c:48
enum EPlayerSoundEventType HIGHEST_PRIORITY
enum EPlayerSoundEventType SKIP_CONTROLLED_PLAYER
void ~PlayerSoundEventBase()
Определения PlayerSoundEventBase.c:64
EPlayerSoundEventType
Определения PlayerSoundEventBase.c:2
@ INJURY
Определения PlayerSoundEventBase.c:8
@ DUMMY
Определения PlayerSoundEventBase.c:7
@ DROWNING
Определения PlayerSoundEventBase.c:9
@ DAMAGE
Определения PlayerSoundEventBase.c:6
float m_PlayTime
Определения PlayerSoundEventBase.c:38
bool m_IsDummyType
Определения PlayerSoundEventBase.c:36
ref HumanMovementState m_Hms
Определения PlayerSoundEventBase.c:40
float m_DummySoundLength
Определения PlayerSoundEventBase.c:34
enum EPlayerSoundEventType STOP_PLAYBACK
float m_DummyStartTime
Определения PlayerSoundEventBase.c:35
EPlayerSoundEventType m_HasPriorityOverTypes
Определения PlayerSoundEventBase.c:41
bool IsDummy()
Определения PlayerSoundEventBase.c:43
bool m_ProcessPlaybackEvent
Определения PlayerSoundEventBase.c:37
void InitEx(PlayerBase player, int param)
Определения PlayerSoundEventBase.c:136
bool IsFinished()
Определения PlayerSoundEventBase.c:80
void PlayerSoundEventBase()
Определения PlayerSoundEventBase.c:59
bool IsDummyFinished()
Определения PlayerSoundEventBase.c:92
void OnInterupt()
Определения PlayerSoundEventBase.c:162
int GetSoundVoiceAnimEventClassID()
Определения PlayerSoundEventBase.c:70
EPlayerSoundEventID
Определения PlayerSoundEventHandler.c:3
@ STAMINA
Определения PlayerStatsPCO.c:149
static proto native void SendEvent(StatsEventData data)
universal analytics event
AbstractWave m_SoundSetCallback
Определения SoundEvents.c:86
bool IsSoundCallbackExist()
Определения SoundEvents.c:115
int m_SoundVoiceAnimEventClassID
Определения SoundEvents.c:89
int m_Param
Определения SoundEvents.c:93
Определения Sound.c:147
Определения human.c:1154
Определения EnMath.c:7
Определения PlayerBaseClient.c:2
override void OnEnd()
Определения JumpEvents.c:24
override bool HasPriorityOverCurrent(PlayerBase player, EPlayerSoundEventID other_state_id, EPlayerSoundEventType type_other)
Определения DamageEvents.c:15
override bool HasHoldBreathException()
Определения HoldBreathEvents.c:8
proto bool Insert(func fn, int flags=EScriptInvokerInsertFlags.IMMEDIATE)
insert method to list
Определения SoundEvents.c:2
static proto float Clamp(float value, float min, float max)
Clamps 'value' to 'min' if it is lower than 'min', or to 'max' if it is higher than 'max'.
proto void Play()
Определения SmptAnimMeta.c:144
void OnEnd()
Определения Sound.c:226
ref ScriptInvoker Event_OnSoundWaveEnded
Определения Sound.c:152
ref ScriptInvoker Event_OnSoundWaveStopped
Определения Sound.c:149
void OnPlay()
Определения Sound.c:206