DayZ 1.28
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 int m_PivotIndex = -1;
43 protected vector m_Position;
45
50
51 protected int m_ID;
53 protected bool m_IsRegistered;
55
61
62 protected vector m_LocalPos;
64 protected vector m_LocalOri;
66
67
68
72 void Effect()
73 {
74 if (GetGame().IsDedicatedServer())
75 {
76 ErrorEx("Created Effect on server.", ErrorExSeverity.WARNING);
77 }
78
79 m_IsPlaying = false;
80
81 InitEffect();
82 }
83
87 void ~Effect()
88 {
89 // Safety
90 if ( IsRegistered() )
92
93 // Certain effects need to be stopped to clean up properly
94 Stop();
95
96 // Another safety
98 }
99
109
110
115
121 {
122 return EffectType.NONE;
123 }
124
129 bool IsSound()
130 {
131 return false;
132 }
133
139 {
140 return false;
141 }
142
144
145
146
152
157 void Start()
158 {
159 // It is already playing!
160 if (IsPlaying())
161 return;
162
164 // I can't call this from inside the method with same name
165 // because that method is often overriden without super......
166 Event_OnStarted.Invoke(this);
167 }
168
175 {
176
177 }
178
183 void Stop()
184 {
185 // It is not playing!
186 if (!IsPlaying())
187 return;
188
190 // Yes, that event is new, but let's keep up some consistency
191 Event_OnStopped.Invoke(this);
192 }
193
198 {
199 return m_IsPlaying;
200 }
201
203
204
205
210
216 protected void Destroy()
217 {
218 // Already queued
219 if (IsPendingDeletion())
220 return;
221
222 // Mark it to prevent queuing it up multiple times or get stuck in a call loop
223 m_IsPendingDeletion = true;
224
225 // Stop it, so that the effects can clean up themselves
226 // Since if for example this is EffectParticle and the particle is looping
227 // It NEEDS to be stopped to clean up the Particle
228 Stop();
229
230 // Queue up the destroying, as we should not do it while we are accessing it here
231 if (GetGame())
232 {
234 }
235 }
236
242 void SetAutodestroy(bool auto_destroy)
243 {
244 m_IsAutodestroy = auto_destroy;
245 }
246
252 {
253 return m_IsAutodestroy;
254 }
255
261 {
262 return m_IsPendingDeletion;
263 }
264
270 {
271 return true;
272 }
273
275
276
277
282 void SetEnableEventFrame(bool enable)
283 {
284 if ( enable )
285 {
287 }
288 else
289 {
291 }
292 }
293
294
295
300
305 {
306 // Override this method for own use
307 }
308
312 void Event_OnStopped()
313 {
314 // Override this method for own use
315 }
316
321 {
322 m_IsPlaying = true;
323
325 }
326
331 {
332 m_IsPlaying = false;
333
335
336 if ( IsAutodestroy() )
337 {
338 Destroy();
339 }
340 }
341
347 void Event_OnFrameUpdate(float time_delta)
348 {
349 // Override this method for own use
350 }
351
358 {
359 SetID(id);
360 m_IsRegistered = true;
361 }
362
372
379 {
380
381 }
382
384
385
386
391
399 void SetParent(Object parent_obj, int pivot)
400 {
401 m_ParentObject = parent_obj;
402 m_PivotIndex = pivot;
403 }
404
411 void SetParent(Object parent_obj)
412 {
413 SetParent(parent_obj, -1);
414 }
415
423 {
424 return m_ParentObject;
425 }
426
433 {
434 return m_PivotIndex;
435 }
436
443 void SetCurrentParent( Object parent_obj, bool updateCached = true )
444 {
445 if (updateCached)
446 SetParent(parent_obj);
447 }
448
454 {
455 return null;
456 }
457
463 void SetPosition( vector pos )
464 {
465 m_Position = pos;
466 }
467
474 {
475 return m_Position;
476 }
477
483 void SetCurrentPosition( vector pos, bool updateCached = true )
484 {
485 if (updateCached)
486 SetPosition(pos);
487 }
488
494 {
495 return vector.Zero;
496 }
497
504 {
505 m_LocalPos = pos;
506 }
507
514 {
515 return m_LocalPos;
516 }
517
523 void SetCurrentLocalPosition( vector pos, bool updateCached = true )
524 {
525 if (updateCached)
526 SetLocalPosition(pos);
527 }
528
534 {
535 return vector.Zero;
536 }
537
539
540
541
546
552 protected void SetID(int id)
553 {
554 m_ID = id;
555 }
556
561 int GetID()
562 {
563 return m_ID;
564 }
565
571 {
572 return m_IsRegistered;
573 }
574
576
577
578
585
591 {
592 SetParent(obj);
593 }
594
600 {
601 return GetParent();
602 }
603
609 {
610 SetLocalPosition(pos);
611 }
612
618 {
619 return GetLocalPosition();
620 }
621
629 {
630 m_LocalOri = ori;
631 }
632
639 {
640 return m_LocalOri;
641 }
642
644}
bool m_IsRegistered
Whether the effect is registered in SEffectManager.
Определения Effect.c:53
void Start()
Plays all elements this effects consists of.
Определения Effect.c:157
void Event_OnRegistered(int id)
Event called from SEffectManager when the Effect is registered.
Определения Effect.c:357
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:443
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:561
vector GetAttachedLocalPos()
Get the local pos set by SetAttachedLocalPos.
Определения Effect.c:617
void SetParent(Object parent_obj, int pivot)
Set parent of the Effect.
Определения Effect.c:399
vector GetCurrentPosition()
Get the current world position of the managed effect.
Определения Effect.c:493
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:453
PARTICLE
EffectParticle.
Определения Effect.c:9
int GetPivotIndex()
Get parent pivot of the Effect, only valid when there is some GetParent.
Определения Effect.c:432
bool m_IsPendingDeletion
Whether the Destroy process has already been called.
Определения Effect.c:35
int m_PivotIndex
Cached parent pivot id.
Определения Effect.c:41
int m_ID
ID of effect, given by SEffectManager when registered (automatically done when playing through it)
Определения Effect.c:51
bool IsRegistered()
Get whether this Effect is registered in SEffectManager.
Определения Effect.c:570
bool IsPlaying()
Returns true when the Effect is playing, false otherwise.
Определения Effect.c:197
void InitEffect()
init
Определения Effect.c:103
void SetCurrentPosition(vector pos, bool updateCached=true)
Set the current world position of the managed effect.
Определения Effect.c:483
void SetAttachedLocalPos(vector pos)
Set local pos for the Effect relative to the parent.
Определения Effect.c:608
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:503
vector GetLocalPosition()
Get the local position of the Effect.
Определения Effect.c:513
vector m_Position
Cached world position.
Определения Effect.c:43
ref ScriptInvoker Event_OnStopped
Event used when Stop was called.
Определения Effect.c:23
void Effect()
ctor
Определения Effect.c:72
bool IsParticle()
Check whether the Effect is EffectParticle without casting.
Определения Effect.c:138
void SetAttachmentParent(Object obj)
Set parent for the Effect.
Определения Effect.c:590
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:174
void SetCurrentLocalPosition(vector pos, bool updateCached=true)
Set the current local position of the managed effect.
Определения Effect.c:523
vector GetCurrentLocalPosition()
Get the current local position of the managed effect.
Определения Effect.c:533
void Event_OnFrameUpdate(float time_delta)
Event called on frame when enabled by SetEnableEventFrame(true)
Определения Effect.c:347
void SetID(int id)
Set the ID registered in SEffectManager.
Определения Effect.c:552
void ~Effect()
dtor
Определения Effect.c:87
Event_OnStarted
Event used when Start was called.
Определения Effect.c:304
vector m_LocalPos
Cached local pos.
Определения Effect.c:62
EffectType GetEffectType()
Get what type of effect the Effect is.
Определения Effect.c:120
bool IsSound()
Check whether the Effect is EffectSound without casting.
Определения Effect.c:129
void SetAttachedLocalOri(vector ori)
Set local orientation for the Effectparticle to attach to when the Effect is started.
Определения Effect.c:628
void Event_OnUnregistered()
Event called from SEffectManager when the Effect is unregistered.
Определения Effect.c:367
vector m_LocalOri
Local orientation set by SetAttachedLocalOri, only used by EffectParticle.
Определения Effect.c:64
vector GetAttachedLocalOri()
Get the local orientation set by SetAttachedLocalOri.
Определения Effect.c:638
Object GetAttachmentParent()
Get the parent set by SetAttachmentParent.
Определения Effect.c:599
void OnCheckUpdate()
Event used when EffectParticle.CheckLifeSpan was called (DEPRECATED)
Определения Effect.c:378
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:
Определения 2_GameLib/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:282
enum ShapeType ErrorEx
proto native void SetPosition(vector position)
Set the world position of the Effect.
Определения Effect.c:463
proto native void Destroy()
Cleans up the Effect, including unregistering if needed.
Определения Effect.c:216
bool IsPendingDeletion()
Get whether the Effect is queued up for being cleaned up.
Определения Effect.c:260
bool IsAutodestroy()
Get whether Effect automatically cleans up when it stops.
Определения Effect.c:251
bool CanDestroy()
Get whether the Effect can be destroyed right now.
Определения Effect.c:269
void SetAutodestroy(bool auto_destroy)
Sets whether Effect automatically cleans up when it stops.
Определения Effect.c:242
@ NONE
No flags.
Определения EnProfiler.c:11
class JsonUndergroundAreaTriggerData GetPosition
Определения UndergroundAreaLoader.c:9
void Stop()
Stops all elements this effect consists of.
Определения Effect.c:183
const int CALL_CATEGORY_GAMEPLAY
Определения 3_Game/tools/tools.c:10
proto native Widget GetParent()
Get parent of the Effect.
Определения Effect.c:422