DayZ 1.27
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 /*
18 STAMINA = 0x00000004,
19 DAMAGE = 0x00000008,
20 DUMMY = 0x00000010,
21 INJURY = 0x00000020,
22 HEAT_COMFORT = 0x00000040,
23 */
24
25 // ONLY COUNT BELLOW
27
28}
29
31{
38
41
42 bool IsDummy()
43 {
44 return m_IsDummyType;
45 }
46
51
52 // !can this event play during hold breath
54 {
55 return false;
56 }
57
59 {
61 }
62
64 {
66 OnEnd();
67 }
68
73
75 {
76 return true;
77 }
78
80 {
81 if(IsDummy())
82 {
83 return IsDummyFinished();
84 }
85 else
86 {
87 return !IsSoundCallbackExist();
88 }
89 }
90
92 {
94 }
95
96
97 void OnTick(float delta_time)
98 {
100 {
101 m_SoundSetCallback.SetPosition(m_Player.GetPosition());
102 //---------- Playback event -------------
103 if( delta_time > 0 && m_ProcessPlaybackEvent )//delta_time 0 is for remotes
104 {
105
106 m_PlayTime += delta_time;
107 //this is not 100% precise as the playback position is not obtained from the sound system
108 float playback01 = Math.Clamp(m_PlayTime / m_SoundSetCallback.GetLength(),0,1);
109 SendEvent(playback01);
110 //---------- Playback event -------------
111 }
112 }
113 }
114
115 bool CanPlay(PlayerBase player)
116 {
117 player.GetMovementState(m_Hms);
118
119 if (player.IsHoldingBreath() && !HasHoldBreathException())
120 {
121 return false;
122 }
123 if (player.m_IsDrowning || (player.IsSwimming() && m_Hms.m_iMovement != 0))
124 {
125 return false;
126 }
127 return true;
128 }
129
130 void Init(PlayerBase player)
131 {
132 InitEx(player,0);
133 }
134
135 void InitEx(PlayerBase player, int param)
136 {
137 m_Player = player;
138 m_Param = param;
139 if (param & EPlayerSoundEventParam.HIGHEST_PRIORITY)
140 {
142 }
143 }
144
145 void OnEnd()
146 {
148 SendEvent(1);
149 }
150
151 void SendEvent(float time)
152 {
153 if(m_PlayTime < 0 || !m_SoundSetCallback)//negative m_PlayTime value indicates the event has already been sent for playback01 = 1
154 return;
155
156 m_Player.OnVoiceEventPlayback(this, m_SoundSetCallback, time);
157 if(time >= 1)
158 m_PlayTime = -float.MAX;
159 }
160
162 {
163
164 }
165
166 override void OnPlay(PlayerBase player)
167 {
168 super.OnPlay(player);
169 //Print("start playing -------------------->" + m_Type);
170 player.OnVoiceEvent(this);
171 //m_Player.OnVoiceEventDuration(m_SoundSetCallback, 0);
172 }
173
174 override bool Play()
175 {
176 if(!super.Play())
177 return false;
178
179 if( !IsDummy() )
180 {
181 m_SoundSetCallback = m_Player.ProcessVoiceEvent("","", m_SoundVoiceAnimEventClassID);
182
184 {
185 AbstractWaveEvents events = AbstractWaveEvents.Cast(m_SoundSetCallback.GetUserData());
188 return true;
189 }
190 else
191 return false;
192 }
193 else
194 {
196 return true;
197 }
198 return false;
199
200 }
201}
eBleedingSourceType m_Type
Определения BleedingSource.c:25
override Widget Init()
Определения DayZGame.c:127
DayZPlayer m_Player
Определения Hand_Events.c:42
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:47
enum EPlayerSoundEventType HIGHEST_PRIORITY
enum EPlayerSoundEventType SKIP_CONTROLLED_PLAYER
void ~PlayerSoundEventBase()
Определения PlayerSoundEventBase.c:63
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:37
bool m_IsDummyType
Определения PlayerSoundEventBase.c:35
ref HumanMovementState m_Hms
Определения PlayerSoundEventBase.c:39
float m_DummySoundLength
Определения PlayerSoundEventBase.c:33
float m_DummyStartTime
Определения PlayerSoundEventBase.c:34
EPlayerSoundEventType m_HasPriorityOverTypes
Определения PlayerSoundEventBase.c:40
bool IsDummy()
Определения PlayerSoundEventBase.c:42
bool m_ProcessPlaybackEvent
Определения PlayerSoundEventBase.c:36
void InitEx(PlayerBase player, int param)
Определения PlayerSoundEventBase.c:135
bool IsFinished()
Определения PlayerSoundEventBase.c:79
void PlayerSoundEventBase()
Определения PlayerSoundEventBase.c:58
bool IsDummyFinished()
Определения PlayerSoundEventBase.c:91
void OnInterupt()
Определения PlayerSoundEventBase.c:161
int GetSoundVoiceAnimEventClassID()
Определения PlayerSoundEventBase.c:69
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
proto int GetTime()
returns mission time in milliseconds
Определения human.c:1139
Определения 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
proto native CGame GetGame()
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