DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
Effect.c
См. документацию.
1
11
16class Effect : Managed
17{
22 ref ScriptInvoker Event_OnStarted = new ScriptInvoker();
27
32
33 protected bool m_IsAutodestroy;
35 protected bool m_IsPendingDeletion;
37 protected bool m_IsPlaying;
41 protected vector m_Position;
43
48
49 protected int m_ID;
51 protected bool m_IsRegistered;
53
59
60 protected vector m_LocalPos;
62 protected vector m_LocalOri;
64
65
66
70 void Effect()
71 {
72 if (GetGame().IsDedicatedServer())
73 {
74 ErrorEx("Created Effect on server.", ErrorExSeverity.WARNING);
75 }
76
77 m_IsPlaying = false;
78
79 InitEffect();
80 }
81
85 void ~Effect()
86 {
87 // Safety
88 if ( IsRegistered() )
90
91 // Certain effects need to be stopped to clean up properly
92 Stop();
93
94 // Another safety
96 }
97
107
108
113
119 {
120 return EffectType.NONE;
121 }
122
127 bool IsSound()
128 {
129 return false;
130 }
131
137 {
138 return false;
139 }
140
142
143
144
150
155 void Start()
156 {
157 // It is already playing!
158 if (IsPlaying())
159 return;
160
162 // I can't call this from inside the method with same name
163 // because that method is often overriden without super......
164 Event_OnStarted.Invoke(this);
165 }
166
173 {
174
175 }
176
181 void Stop()
182 {
183 // It is not playing!
184 if (!IsPlaying())
185 return;
186
188 // Yes, that event is new, but let's keep up some consistency
189 Event_OnStopped.Invoke(this);
190 }
191
196 {
197 return m_IsPlaying;
198 }
199
201
202
203
208
214 protected void Destroy()
215 {
216 // Already queued
217 if (IsPendingDeletion())
218 return;
219
220 // Mark it to prevent queuing it up multiple times or get stuck in a call loop
221 m_IsPendingDeletion = true;
222
223 // Stop it, so that the effects can clean up themselves
224 // Since if for example this is EffectParticle and the particle is looping
225 // It NEEDS to be stopped to clean up the Particle
226 Stop();
227
228 // Queue up the destroying, as we should not do it while we are accessing it here
229 if (GetGame())
230 {
232 }
233 }
234
240 void SetAutodestroy(bool auto_destroy)
241 {
242 m_IsAutodestroy = auto_destroy;
243 }
244
250 {
251 return m_IsAutodestroy;
252 }
253
259 {
260 return m_IsPendingDeletion;
261 }
262
268 {
269 return true;
270 }
271
273
274
275
280 void SetEnableEventFrame(bool enable)
281 {
282 if ( enable )
283 {
285 }
286 else
287 {
289 }
290 }
291
292
293
298
303 {
304 // Override this method for own use
305 }
306
310 void Event_OnStopped()
311 {
312 // Override this method for own use
313 }
314
319 {
320 m_IsPlaying = true;
321
323 }
324
329 {
330 m_IsPlaying = false;
331
333
334 if ( IsAutodestroy() )
335 {
336 Destroy();
337 }
338 }
339
345 void Event_OnFrameUpdate(float time_delta)
346 {
347 // Override this method for own use
348 }
349
356 {
357 SetID(id);
358 m_IsRegistered = true;
359 }
360
370
377 {
378
379 }
380
382
383
384
389
396 void SetParent(Object parent_obj)
397 {
398 m_ParentObject = parent_obj;
399 }
400
408 {
409 return m_ParentObject;
410 }
411
418 void SetCurrentParent( Object parent_obj, bool updateCached = true )
419 {
420 if (updateCached)
421 SetParent(parent_obj);
422 }
423
429 {
430 return null;
431 }
432
438 void SetPosition( vector pos )
439 {
440 m_Position = pos;
441 }
442
449 {
450 return m_Position;
451 }
452
458 void SetCurrentPosition( vector pos, bool updateCached = true )
459 {
460 if (updateCached)
461 SetPosition(pos);
462 }
463
469 {
470 return vector.Zero;
471 }
472
479 {
480 m_LocalPos = pos;
481 }
482
489 {
490 return m_LocalPos;
491 }
492
498 void SetCurrentLocalPosition( vector pos, bool updateCached = true )
499 {
500 if (updateCached)
501 SetLocalPosition(pos);
502 }
503
509 {
510 return vector.Zero;
511 }
512
514
515
516
521
527 protected void SetID(int id)
528 {
529 m_ID = id;
530 }
531
536 int GetID()
537 {
538 return m_ID;
539 }
540
546 {
547 return m_IsRegistered;
548 }
549
551
552
553
560
566 {
567 SetParent(obj);
568 }
569
575 {
576 return GetParent();
577 }
578
584 {
585 SetLocalPosition(pos);
586 }
587
593 {
594 return GetLocalPosition();
595 }
596
604 {
605 m_LocalOri = ori;
606 }
607
614 {
615 return m_LocalOri;
616 }
617
619}
bool m_IsRegistered
Whether the effect is registered in SEffectManager.
Определения Effect.c:51
void Start()
Plays all elements this effects consists of.
Определения Effect.c:155
void Event_OnRegistered(int id)
Event called from SEffectManager when the Effect is registered.
Определения Effect.c:355
bool m_IsAutodestroy
Whether the Effect cleans up after itself when stopped.
Определения Effect.c:33
void SetCurrentParent(Object parent_obj, bool updateCached=true)
Set current parent of the managed effect.
Определения Effect.c:418
bool m_IsPlaying
Whether the Effect is currently playing.
Определения Effect.c:37
Object m_ParentObject
Cached parent.
Определения Effect.c:39
int GetID()
Get the ID registered in SEffectManager.
Определения Effect.c:536
vector GetAttachedLocalPos()
Get the local pos set by SetAttachedLocalPos.
Определения Effect.c:592
vector GetCurrentPosition()
Get the current world position of the managed effect.
Определения Effect.c:468
ref ScriptInvoker Event_OnEffectStarted
Event used when the actual effect started playing.
Определения Effect.c:24
EffectType
Enum to determine what type of effect the Effect is.
Определения Effect.c:3
Object GetCurrentParent()
Get the current parent of the managed Effect.
Определения Effect.c:428
PARTICLE
EffectParticle.
Определения Effect.c:9
bool m_IsPendingDeletion
Whether the Destroy process has already been called.
Определения Effect.c:35
void SetParent(Object parent_obj)
Set parent of the Effect.
Определения Effect.c:396
int m_ID
ID of effect, given by SEffectManager when registered (automatically done when playing through it)
Определения Effect.c:49
bool IsRegistered()
Get whether this Effect is registered in SEffectManager.
Определения Effect.c:545
bool IsPlaying()
Returns true when the Effect is playing, false otherwise.
Определения Effect.c:195
void InitEffect()
init
Определения Effect.c:101
void SetCurrentPosition(vector pos, bool updateCached=true)
Set the current world position of the managed effect.
Определения Effect.c:458
void SetAttachedLocalPos(vector pos)
Set local pos for the Effect relative to the parent.
Определения Effect.c:583
ref ScriptInvoker Event_OnEffectEnded
Event used when the actual effect stopped playing.
Определения Effect.c:25
void SetLocalPosition(vector pos)
Set the local position of the Effect.
Определения Effect.c:478
vector GetLocalPosition()
Get the local position of the Effect.
Определения Effect.c:488
vector m_Position
Cached world position.
Определения Effect.c:41
ref ScriptInvoker Event_OnStopped
Event used when Stop was called.
Определения Effect.c:23
void Effect()
ctor
Определения Effect.c:70
bool IsParticle()
Check whether the Effect is EffectParticle without casting.
Определения Effect.c:136
void SetAttachmentParent(Object obj)
Set parent for the Effect.
Определения Effect.c:565
SOUND
EffectSound.
Определения Effect.c:7
void ValidateStart()
Validation whether an effect truly started playing or if the Effect should stop as none is present.
Определения Effect.c:172
void SetCurrentLocalPosition(vector pos, bool updateCached=true)
Set the current local position of the managed effect.
Определения Effect.c:498
vector GetCurrentLocalPosition()
Get the current local position of the managed effect.
Определения Effect.c:508
void Event_OnFrameUpdate(float time_delta)
Event called on frame when enabled by SetEnableEventFrame(true)
Определения Effect.c:345
void SetID(int id)
Set the ID registered in SEffectManager.
Определения Effect.c:527
void ~Effect()
dtor
Определения Effect.c:85
Event_OnStarted
Event used when Start was called.
Определения Effect.c:302
vector m_LocalPos
Cached local pos.
Определения Effect.c:60
EffectType GetEffectType()
Get what type of effect the Effect is.
Определения Effect.c:118
bool IsSound()
Check whether the Effect is EffectSound without casting.
Определения Effect.c:127
void SetAttachedLocalOri(vector ori)
Set local orientation for the Effectparticle to attach to when the Effect is started.
Определения Effect.c:603
void Event_OnUnregistered()
Event called from SEffectManager when the Effect is unregistered.
Определения Effect.c:365
vector m_LocalOri
Local orientation set by SetAttachedLocalOri, only used by EffectParticle.
Определения Effect.c:62
vector GetAttachedLocalOri()
Get the local orientation set by SetAttachedLocalOri.
Определения Effect.c:613
Object GetAttachmentParent()
Get the parent set by SetAttachmentParent.
Определения Effect.c:574
void OnCheckUpdate()
Event used when EffectParticle.CheckLifeSpan was called (DEPRECATED)
Определения Effect.c:376
override ScriptCallQueue GetCallQueue(int call_category)
Определения DayZGame.c:1187
TODO doc.
Определения EnScript.c:118
Определения ObjectTyped.c:2
static void EffectUnregister(int id)
Unregisters Effect in SEffectManager.
Определения EffectManager.c:369
static const int INVALID_ID
As the counter starts at 1, Effect ID can never be 0.
Определения EffectManager.c:14
static ref ScriptInvoker Event_OnFrameUpdate
Static invoker for the SEffectManager.Event_OnFrameUpdate called form MissionGameplay....
Определения EffectManager.c:24
static void DestroyEffect(Effect effect)
Unregisters, stops and frees the Effect.
Определения EffectManager.c:271
Manager class for managing Effect (EffectParticle, EffectSound)
Определения EffectManager.c:6
proto void Call(func fn, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL)
adds call into the queue with given parameters and arguments (arguments are held in memory until the ...
proto bool Remove(func fn, int flags=EScriptInvokerRemoveFlags.ALL)
remove specific call from list
proto void Invoke(void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL)
invoke call on all inserted methods with given arguments
proto bool Insert(func fn, int flags=EScriptInvokerInsertFlags.IMMEDIATE)
insert method to list
ScriptInvoker Class provide list of callbacks usage:
Определения tools.c:116
static const vector Zero
Определения EnConvert.c:110
Определения EnConvert.c:106
proto native CGame GetGame()
ErrorExSeverity
Определения EnDebug.c:62
void SetEnableEventFrame(bool enable)
Enable Event_OnFrameUpdate for the effect.
Определения Effect.c:280
enum ShapeType ErrorEx
proto native void SetPosition(vector position)
Set the world position of the Effect.
Определения Effect.c:438
proto native void Destroy()
Cleans up the Effect, including unregistering if needed.
Определения Effect.c:214
bool IsPendingDeletion()
Get whether the Effect is queued up for being cleaned up.
Определения Effect.c:258
bool IsAutodestroy()
Get whether Effect automatically cleans up when it stops.
Определения Effect.c:249
bool CanDestroy()
Get whether the Effect can be destroyed right now.
Определения Effect.c:267
void SetAutodestroy(bool auto_destroy)
Sets whether Effect automatically cleans up when it stops.
Определения Effect.c:240
@ NONE
No flags.
Определения EnProfiler.c:11
class JsonUndergroundAreaTriggerData GetPosition
Определения UndergroundAreaLoader.c:9
void Stop()
Stops all elements this effect consists of.
Определения Effect.c:181
const int CALL_CATEGORY_GAMEPLAY
Определения tools.c:10
proto native Widget GetParent()
Get parent of the Effect.
Определения Effect.c:407