DayZ 1.30
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено

◆ GetAdjustedSoundSet()

string GetLowerSoundsetVariant::GetAdjustedSoundSet ( vector effectPos)
protected

См. определение в файле DustEffectCeilingHandler.c строка 191

192{
193 protected static int RANGE_MIN_DEFAULT = 4;
194 protected static int RANGE_MAX_DEFAULT = 8;
195 protected static float FLOOR_THICKNESS_DEFAULT = 0.4;
196
197 protected EntityAI m_Owner;
198 protected int m_StepCounter;
199 protected int m_NextEffectStepIdx;
200
202 {
203 m_Owner = owner;
204 m_StepCounter = 0;
205 }
206
207 protected void CalculateNextEffect(string surfaceType, int particleID)
208 {
209 int rangeMin = RANGE_MIN_DEFAULT;
210 int rangeMax = RANGE_MAX_DEFAULT;
211 DustEffectManager.AdjustCeilingDustEffectFrequency(surfaceType, particleID, rangeMin, rangeMax);
212 m_NextEffectStepIdx = Math.RandomIntInclusive(rangeMin,rangeMax);
213 }
214
215 void OnStepUpdate(SurfaceInfo surfaceInfo, string boneName = "")
216 {
217 int ceilingParticleID = surfaceInfo.GetCeilingDustParticleId();
218 if (ceilingParticleID <= 0)
219 return;
220
222
224 {
225 vector pos = GetBonePosition(boneName);
226 AdjustBySurfaceThickness(pos, surfaceInfo);
227 CreateEffects(ceilingParticleID, pos);
228 m_StepCounter = 0;
229 CalculateNextEffect(surfaceInfo.GetSurfaceType(), ceilingParticleID);
230 }
231 }
232
233 protected vector GetBonePosition(string boneName)
234 {
235 DayZCreature creature;
236 DayZPlayerImplement player;
237
238 vector ownerPos = m_Owner.GetPosition();
239 if (boneName == "")
240 return ownerPos;
241
242 int boneIdx = -1;
243 if (Class.CastTo(creature, m_Owner))
244 boneIdx = creature.GetBoneIndexByName(boneName);
245 if (Class.CastTo(player, m_Owner))
246 boneIdx = player.GetBoneIndexByName(boneName);
247
248 if (boneIdx == -1)
249 return ownerPos;
250
251 vector bonePos = m_Owner.GetBonePositionWS(boneIdx);
252 bonePos[1] = ownerPos[1]; //equalize Y to allow for consistent height adjustment later
253 return bonePos;
254 }
255
256 protected void AdjustBySurfaceThickness(inout vector pos, SurfaceInfo surfaceInfo)
257 {
258 float thicc = surfaceInfo.GetThickness(); //returns '-1' if not defined, for reasons
259 if (thicc < 0)
261 pos[1] = pos[1] - thicc;
262 }
263
264 protected void CreateEffects(int ceilingParticleID, vector position);
265}
266
267class DustEffectCeilingHandlerLocal : DustEffectCeilingHandlerBase
268{
269 override protected void CreateEffects(int ceilingParticleID, vector position)
270 {
271 if (DustEffectManager.GetDustEffectManager().IsCeilingDustEffectEnabled())
272 {
273 CeilingDustEffectBase effect = CeilingDustEffectBase.Cast(DustEffectManager.GetCeilingEffectType(ceilingParticleID).ToType().Spawn());
274 effect.SetParticle(ceilingParticleID);
275 effect.SetAutodestroy(true);
276 SEffectManager.PlayInWorld(effect, position);
277 }
278 }
279}
280
283{
285 override protected void CreateEffects(int ceilingParticleID, vector position)
286 {
287 //'spam' variant of effecters solution
288 SEffectManager.CreateParticleServer(position, new ParticleEffecterParameters("CeilingDustEffecter", 2.0, ceilingParticleID));
289 }
290}
291
293//effecter
294
295class CeilingDustEffecter : ParticleEffecter
296{
297 override protected typename GetEffectTypename()
298 {
299 return DustEffectManager.GetCeilingEffectType(m_ParticleEffectIDSync).ToType();
300 }
301}
302
304//effect class
305
307{
309 {
311 }
312
314 {
316 }
317
318 protected void PlayCeilingDustSound()
319 {
320 SEffectManager.PlaySound(GetAdjustedSoundSet(m_Position), m_Position).SetAutodestroy(true);
321 }
322
323 override void Start()
324 {
325 if (!DustEffectManager.GetDustEffectManager().IsCeilingDustEffectEnabled())
326 return;
327
328 super.Start();
329 }
330
331 protected string GetAdjustedSoundSet(vector effectPos)
332 {
333 vector playerPos = g_Game.GetPlayer().GetPosition();
334 bool upperVariant = effectPos[1] < playerPos[1];
335
336 if (upperVariant)
339 }
340
342 //methods to override in children classes
343
344 protected string GetLowerSoundsetVariant()
345 {
346 return "";
347 }
348
349 protected string GetUpperSoundsetVariant()
350 {
351 return "";
352 }
353}
354
355class CeilingDustEffectWood : CeilingDustEffectBase
356{
357 override protected string GetLowerSoundsetVariant()
358 {
359 return "CeilingDustEffect_SoundSet";
360 }
361
362 override protected string GetUpperSoundsetVariant()
363 {
364 return "CeilingDustEffectTop_SoundSet";
365 }
366}
DayZGame g_Game
Определения DayZGame.c:4074
class DustEffectCeilingHandlerBase CreateEffects(int ceilingParticleID, vector position)
Request from server, effecter handles the rest.
Определения DustEffectCeilingHandler.c:79
static float FLOOR_THICKNESS_DEFAULT
Определения DustEffectCeilingHandler.c:82
static int RANGE_MAX_DEFAULT
Определения DustEffectCeilingHandler.c:81
vector GetBonePosition(string boneName)
Определения DustEffectCeilingHandler.c:120
int m_StepCounter
Определения DustEffectCeilingHandler.c:85
void AdjustBySurfaceThickness(inout vector pos, SurfaceInfo surfaceInfo)
Определения DustEffectCeilingHandler.c:143
static int RANGE_MIN_DEFAULT
Определения DustEffectCeilingHandler.c:80
void CalculateNextEffect(string surfaceType, int particleID)
Определения DustEffectCeilingHandler.c:94
void CeilingDustEffectBase()
Определения DustEffectCeilingHandler.c:168
void OnStepUpdate(SurfaceInfo surfaceInfo, string boneName="")
Определения DustEffectCeilingHandler.c:102
void DustEffectCeilingHandlerBase(EntityAI owner)
Определения DustEffectCeilingHandler.c:88
int m_NextEffectStepIdx
Определения DustEffectCeilingHandler.c:86
vector position
Определения DustKickupEffects.c:20
ref ScriptInvoker Event_OnEffectStarted
Event used when the actual effect started playing.
Определения Effect.c:24
vector m_Position
Cached world position.
Определения Effect.c:43
void EffectParticleGeneral()
Определения EffectManager.c:871
enum ProcessDirectDamageFlags m_Owner
void ~CeilingDustEffectBase()
Определения DustEffectCeilingHandler.c:123
void CeilingDustEffectBase()
Определения DustEffectCeilingHandler.c:118
string GetAdjustedSoundSet(vector effectPos)
Определения DustEffectCeilingHandler.c:141
override void Start()
Определения DustEffectCeilingHandler.c:133
string GetUpperSoundsetVariant()
Определения DustEffectCeilingHandler.c:159
string GetLowerSoundsetVariant()
Определения DustEffectCeilingHandler.c:154
void PlayCeilingDustSound()
Определения DustEffectCeilingHandler.c:128
Super root of all classes in Enforce script.
Определения EnScript.c:11
Определения DayZAnimal.c:192
Определения ManBase.c:2
void CreateEffects(int ceilingParticleID, vector position)
void CreateEffects(int ceilingParticleID, vector position)
Request from server, effecter handles the rest.
Определения DustEffectCeilingHandler.c:95
Generic synced solution.
Определения DustEffectCeilingHandler.c:93
static void AdjustCeilingDustEffectFrequency(string surfaceType, int particleID, inout int min, inout int max)
optional adjustment of frequency by particleID
Определения DustEffectsManager.c:706
Определения EnMath.c:7
GetEffectTypename()
Определения EffectManager.c:857
proto bool Remove(func fn, int flags=EScriptInvokerRemoveFlags.ALL)
remove specific call from list
proto bool Insert(func fn, int flags=EScriptInvokerInsertFlags.IMMEDIATE)
insert method to list
proto float GetThickness()
proto string GetSurfaceType()
proto int GetCeilingDustParticleId()
Определения SurfaceInfo.c:9
Определения EnConvert.c:119
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
static int RandomIntInclusive(int min, int max)
Returns a random int number between and min [inclusive] and max [inclusive].
Определения EnMath.c:54