DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
EffectParticle.c
См. документацию.
1
5{
8
13
14 protected int m_ParticleID;
20
26 protected Object m_Object;
28
29
30
35 {
36
37 }
38
43 {
44
45 }
46
50 override void InitEffect()
51 {
52 super.InitEffect();
53
54 // Would be neat, but since particles are often already playing
55 // BEFORE they are even registered as the particle for the Effect
56 // Better to just keep that one I guess..
57 // Event_OnStarted.Remove(Event_OnEffectStarted);
58
59 // Will be called by the particle events
61 }
62
63
67 override string GetDebugName()
68 {
69 string identifier;
70 if (GetParticle())
71 {
72 identifier = GetParticle().GetDebugNameNative();
73 }
74 else
75 {
76 identifier = "NO_PARTICLE";
77 }
78
79 return string.Format("%1:%2:%3", super.GetDebugName(), m_ParticleID, identifier);
80 }
81
87 override void ValidateStart()
88 {
89 if (!GetParticle())
90 {
91 //ErrorEx(string.Format("No Particle started playing, stopping EffectParticle: %1", GetDebugName()), ErrorExSeverity.WARNING);
92 Stop();
93 }
94 }
95
96
97
102
108 {
109 return EffectType.PARTICLE;
110 }
111
116 override bool IsParticle()
117 {
118 return true;
119 }
120
122
123
124
129
135 {
136 // Unregister the events on the old
137 if (m_ParticleObj)
138 {
139 ParticleEvents ope = m_ParticleObj.GetEvents();
142 }
143
144 // Assign the new main Particle
145 m_ParticleObj = p;
146
147 // Register the events on the new
148 if (m_ParticleObj)
149 {
150 ParticleEvents npe = m_ParticleObj.GetEvents();
152 // We will use Stop instead of End, as old particles were destroyed when they stopped
153 // And this system kinda relies on that
155 }
156 }
157
163 {
164 return m_ParticleObj;
165 }
166
168
169
170
176
181 override void Start()
182 {
183 if (m_ParticleID > 0)
184 {
185 vector pos = GetPosition();
186 vector ori = GetOrientation();
187
188 if (m_ParentObject)
189 {
190 pos = GetLocalPosition();
191 ori = GetAttachedLocalOri();
192 }
193
194 SetParticle(ParticleManager.GetInstance().CreateParticle(m_ParticleID, pos, true, GetParent(), ori, IsParticleRotationRelativeToWorld()));
195 }
196
197 super.Start();
198 }
199
204 override void Stop()
205 {
206 if ( GetParticle() )
207 {
208 GetParticle().Stop();
209 SetParticle(null);
210 }
211
212 super.Stop();
213 }
214
216
217
218
223
227 void AttachTo(Object obj, vector local_pos = "0 0 0", vector local_ori = "0 0 0", bool force_rotation_to_world = false)
228 {
229 // Update the cached variables...
230 SetParent(obj);
231 SetLocalPosition(local_pos);
232 SetAttachedLocalOri(local_ori);
233 ForceParticleRotationRelativeToWorld(force_rotation_to_world);
234
235 // Now attach it
236 AddAsChild(obj, local_pos, local_ori, force_rotation_to_world);
237 }
238
242 void ReAttach()
243 {
244 // Skip the updating, as we are going to reuse what was set before
246 }
247
251 protected void AddAsChild(Object obj, vector local_pos, vector local_ori, bool force_rotation_to_world)
252 {
253 Particle p = GetParticle();
254 if (p)
255 {
256 p.AddAsChild(obj, local_pos, local_ori, force_rotation_to_world);
257 }
258 }
259
261
262
263
268
275 {
276
277 }
278
285 {
286
287 }
288
290
291
292
297
303 void SetParticleID( int id )
304 {
305 m_ParticleID = id;
306 }
307
314 {
315 return m_ParticleID;
316 }
317
323 void SetCurrentParticleID( int id )
324 {
325 m_ParticleID = id;
326
327 Particle p = GetParticle();
328 if (p)
329 {
330 p.SetSource(id);
331 }
332 }
333
339 {
340 Particle p = GetParticle();
341 if (p)
342 {
343 return p.GetParticleID();
344 }
345 else
346 {
347 return ParticleList.INVALID;
348 }
349 }
350
356 override void SetCurrentParent( Object parent_obj, bool updateCached = true )
357 {
358 super.SetCurrentParent(parent_obj, updateCached);
359
360 ReAttach();
361 }
362
368 {
369 Particle p = GetParticle();
370
371 if (p)
372 return Object.Cast(p.GetParent());
373 else
374 return super.GetParent();
375 }
376
382 override void SetCurrentPosition( vector pos, bool updateCached = true )
383 {
384 super.SetCurrentPosition(pos, updateCached);
385
386 Particle p = GetParticle();
387
388 if (p)
389 p.SetPosition(pos);
390 }
391
397 {
398 Particle p = GetParticle();
399
400 if (p)
401 return p.GetPosition();
402 else
403 return super.GetPosition();
404 }
405
411 override void SetCurrentLocalPosition( vector pos, bool updateCached = true )
412 {
413 super.SetCurrentLocalPosition(pos, updateCached);
414
415 Particle p = GetParticle();
416 if (p)
417 {
418 Object parent = GetParent();
419
420 if (parent)
421 ReAttach();
422 else
423 p.SetPosition(pos);
424 }
425 }
426
432 {
433 Particle p = GetParticle();
434
435 if (p)
436 {
437 Object parent = GetParent();
438
439 if (parent)
440 return parent.WorldToModel(p.GetPosition());
441 else
442 return p.GetPosition();
443 }
444 else
445 return super.GetLocalPosition();
446 }
447
454 {
455 m_Orientation = ori;
456 }
457
464 {
465 return m_Orientation;
466 }
467
472 void SetCurrentOrientation( vector ori, bool updateCached = true )
473 {
474 if ( updateCached)
475 SetOrientation(ori);
476
477 Particle p = GetParticle();
478
479 if (p)
480 p.SetOrientation(ori);
481 }
482
488 {
489 Particle p = GetParticle();
490
491 if (p)
492 return p.GetOrientation();
493 else
494 return vector.Zero;
495 }
496
507
514 {
515 Particle p = GetParticle();
516
517 if (p)
518 return p.IsHierarchyPositionOnly();
519 else
521 }
522
528 {
529 Particle p = GetParticle();
530
531 if (p)
532 return p.IsHierarchyPositionOnly();
533 else
534 return false;
535 }
536
538
539
540
545
551 {
552 /*
553 if ( !m_ParticleObj )
554 {
555 delete this;
556 }
557
558 OnCheckUpdate();
559 */
560 }
561
563 {
564 m_Object = o;
565 }
566
568}
Object m_ParentObject
Cached parent.
Определения Effect.c:39
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
void SetParent(Object parent_obj)
Set parent of the Effect.
Определения Effect.c:396
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
ref ScriptInvoker Event_OnStopped
Event used when Stop was called.
Определения Effect.c:23
void Effect()
ctor
Определения Effect.c:70
void SetAttachedLocalOri(vector ori)
Set local orientation for the Effectparticle to attach to when the Effect is started.
Определения Effect.c:603
vector GetAttachedLocalOri()
Get the local orientation set by SetAttachedLocalOri.
Определения Effect.c:613
void ParticleManager(ParticleManagerSettings settings)
Constructor (ctor)
Определения ParticleManager.c:88
override string GetDebugName()
Override when getting debug information.
Определения EffectParticle.c:67
override void Stop()
Stops all elements this effect consists of.
Определения EffectParticle.c:204
Particle GetParticle()
Gets the main particle which this Effect is managing.
Определения EffectParticle.c:162
Object m_Object
Определения EffectParticle.c:26
int GetCurrentParticleID()
Gets the current id of the managed Particle.
Определения EffectParticle.c:338
vector GetOrientation()
Get the orientation of the EffectParticle.
Определения EffectParticle.c:463
override void Start()
Plays all elements this effect consists of.
Определения EffectParticle.c:181
bool m_ForceRotationRelativeToWorld
Orientation setting to be used by the effect when the Effect starts.
Определения EffectParticle.c:18
void ~EffectParticle()
dtor
Определения EffectParticle.c:42
void SetParticleID(int id)
Sets the id of the particle to be used.
Определения EffectParticle.c:303
void SetParticle(Particle p)
Sets the main particle which this Effect will manage.
Определения EffectParticle.c:134
void Event_OnPlayStarted()
Event which just simply exists (DEPRECATED)
Определения EffectParticle.c:284
override void ValidateStart()
Validation whether an effect truly started playing or if the Effect should stop as none is present.
Определения EffectParticle.c:87
void EffectParticle()
ctor
Определения EffectParticle.c:34
void SetCurrentOrientation(vector ori, bool updateCached=true)
Set the current orientation of the managed Particle.
Определения EffectParticle.c:472
int GetParticleID()
Gets the id of the particle to be used.
Определения EffectParticle.c:313
override void InitEffect()
init
Определения EffectParticle.c:50
vector GetCurrentOrientation()
Get the current orientation of the managed Particle.
Определения EffectParticle.c:487
bool IsParticleRotationRelativeToWorld()
Get the orientation setting to be used by the effect when the Effect starts.
Определения EffectParticle.c:513
Particle m_ParticleObj
The main Particle effect that this Effect wrapper manages.
Определения EffectParticle.c:7
void ReAttach()
Helper method to attach to parent using stored settings.
Определения EffectParticle.c:242
override Object GetCurrentParent()
Get the current parent of the managed Particle.
Определения EffectParticle.c:367
override void SetCurrentPosition(vector pos, bool updateCached=true)
Set the current world position of the managed Particle.
Определения EffectParticle.c:382
vector m_ParticleOrientation
Определения EffectParticle.c:25
void SetDecalOwner(Object o)
Определения EffectParticle.c:562
void Event_OnPlayStart()
Event which just simply exists (DEPRECATED)
Определения EffectParticle.c:274
override bool IsParticle()
Check whether the Effect is EffectParticle without casting.
Определения EffectParticle.c:116
override void SetCurrentParent(Object parent_obj, bool updateCached=true)
Set current parent of the managed Particle.
Определения EffectParticle.c:356
void ForceParticleRotationRelativeToWorld(bool state)
Set orientation setting to be used by the effect when the Effect starts.
Определения EffectParticle.c:503
override EffectType GetEffectType()
Get what type of effect the Effect is.
Определения EffectParticle.c:107
void AttachTo(Object obj, vector local_pos="0 0 0", vector local_ori="0 0 0", bool force_rotation_to_world=false)
Read Particle.AddAsChild.
Определения EffectParticle.c:227
bool IsParticleCurrentRotationRelativeToWorld()
Get the current orientation setting to be used by the managed Particle.
Определения EffectParticle.c:527
void AddAsChild(Object obj, vector local_pos, vector local_ori, bool force_rotation_to_world)
Helper method to attach to parent.
Определения EffectParticle.c:251
override vector GetCurrentPosition()
Get the current world position of the managed Particle.
Определения EffectParticle.c:396
void SetOrientation(vector ori)
Set orientation of the EffectParticle.
Определения EffectParticle.c:453
override vector GetCurrentLocalPosition()
Get the current local position of the managed Particle.
Определения EffectParticle.c:431
int m_ParticleID
The ID in the ParticleList to create Particle from.
Определения EffectParticle.c:14
override void SetCurrentLocalPosition(vector pos, bool updateCached=true)
Set the current local position of the managed Particle.
Определения EffectParticle.c:411
void SetCurrentParticleID(int id)
Sets the id of the particle to be used.
Определения EffectParticle.c:323
vector m_Orientation
Orientation set by SetOrientation.
Определения EffectParticle.c:16
void CheckLifeSpan()
Was never called and probably should never be called.
Определения EffectParticle.c:550
Определения ObjectTyped.c:2
void SetSource(int particle_id)
Sets particle id.
Определения Particle.c:285
void AddAsChild(Object parent, vector local_pos="0 0 0", vector local_ori="0 0 0", bool force_rotation_to_world=false)
Attaches this particle onto some object. If null value is provided then the particle will be detached...
Определения Particle.c:563
int GetParticleID()
Gets particle id.
Определения Particle.c:297
void Stop()
Legacy function for backwards compatibility with 1.14 and below.
Определения Particle.c:266
ref ScriptInvoker Event_OnParticleStart
Called when particle starts playing.
Определения ParticleBase.c:22
ref ScriptInvoker Event_OnParticleStop
Called when particle stops playing.
Определения ParticleBase.c:28
Invokers for ParticleBase events, called from events.
Определения ParticleBase.c:16
Legacy way of using particles in the game.
Определения Particle.c:7
static const int INVALID
Определения ParticleList.c:20
Определения ParticleList.c:12
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
static const vector Zero
Определения EnConvert.c:110
Определения EnConvert.c:106
class JsonUndergroundAreaTriggerData GetPosition
Определения UndergroundAreaLoader.c:9
static proto string Format(string fmt, 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)
Gets n-th character from string.
proto native Widget GetParent()
Get parent of the Effect.
Определения Effect.c:407