Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
effect.c File Reference

Go to the source code of this file.

Enumerations

enum  EffectType
 Enum to determine what type of effect the Effect is. More...
 

Functions

EffectType

Information about what type of effect the Effect is, without the need for casting

EffectType GetEffectType ()
 Get what type of effect the Effect is. More...
 
bool IsSound ()
 Check whether the Effect is EffectSound without casting. More...
 
bool IsParticle ()
 Check whether the Effect is EffectParticle without casting. More...
 
Playback

Methods to Play/Stop Effect Generally, SEffectManager.Play methods are used instead of Start

void Start ()
 Plays all elements this effects consists of. More...
 
void ValidateStart ()
 Validation whether an effect truly started playing or if the Effect should stop as none is present. More...
 
void Stop ()
 Stops all elements this effect consists of. More...
 
bool IsPlaying ()
 Returns true when the Effect is playing, false otherwise. More...
 
Destroy

Methods regarding automatic cleanup

protected void Destroy ()
 Cleans up the Effect, including unregistering if needed. More...
 
void SetAutodestroy (bool auto_destroy)
 Sets whether Effect automatically cleans up when it stops. More...
 
bool IsAutodestroy ()
 Get whether Effect automatically cleans up when it stops. More...
 
bool IsPendingDeletion ()
 Get whether the Effect is queued up for being cleaned up. More...
 
bool CanDestroy ()
 Get whether the Effect can be destroyed right now. More...
 
void SetEnableEventFrame (bool enable)
 Enable Event_OnFrameUpdate for the effect. More...
 
Events

Various events that can be overriden for custom behaviour

void Event_OnFrameUpdate (float time_delta)
 Event called on frame when enabled by SetEnableEventFrame(true) More...
 
void Event_OnRegistered (int id)
 Event called from SEffectManager when the Effect is registered. More...
 
void Event_OnUnregistered ()
 Event called from SEffectManager when the Effect is unregistered. More...
 
void OnCheckUpdate ()
 Event used when EffectParticle.CheckLifeSpan was called (DEPRECATED) More...
 
Generic API

Setters and getters for generic data and properties

void SetParent (Object parent_obj)
 Set parent of the Effect. More...
 
Object GetParent ()
 Get parent of the Effect. More...
 
void SetCurrentParent (Object parent_obj, bool updateCached=true)
 Set current parent of the managed effect. More...
 
Object GetCurrentParent ()
 Get the current parent of the managed Effect. More...
 
void SetPosition (vector pos)
 Set the world position of the Effect. More...
 
vector GetPosition ()
 Get the world position of the Effect. More...
 
void SetCurrentPosition (vector pos, bool updateCached=true)
 Set the current world position of the managed effect. More...
 
vector GetCurrentPosition ()
 Get the current world position of the managed effect. More...
 
void SetLocalPosition (vector pos)
 Set the local position of the Effect. More...
 
vector GetLocalPosition ()
 Get the local position of the Effect. More...
 
void SetCurrentLocalPosition (vector pos, bool updateCached=true)
 Set the current local position of the managed effect. More...
 
vector GetCurrentLocalPosition ()
 Get the current local position of the managed effect. More...
 
Effect ID

The ID of the effect when registered in SEffectManager

protected void SetID (int id)
 Set the ID registered in SEffectManager. More...
 
int GetID ()
 Get the ID registered in SEffectManager. More...
 
bool IsRegistered ()
 Get whether this Effect is registered in SEffectManager. More...
 
Attachment API

Data to attach an Effect to a parent Mostly replaced by equivalents without 'Attachment' in name Mildly deprecated, exist for backwards compatibility

void SetAttachmentParent (Object obj)
 Set parent for the Effect. More...
 
Object GetAttachmentParent ()
 Get the parent set by SetAttachmentParent. More...
 
void SetAttachedLocalPos (vector pos)
 Set local pos for the Effect relative to the parent. More...
 
vector GetAttachedLocalPos ()
 Get the local pos set by SetAttachedLocalPos. More...
 
void SetAttachedLocalOri (vector ori)
 Set local orientation for the Effectparticle to attach to when the Effect is started. More...
 
vector GetAttachedLocalOri ()
 Get the local orientation set by SetAttachedLocalOri. More...
 

Variables

 NONE
 Plain Effect base. More...
 
 SOUND
 EffectSound. More...
 
 PARTICLE
 EffectParticle. More...
 
Event invokers

Base wrapper class for managing effects (Particles, Sound) through SEffectManager

Note
This is just a base class, not intended for direct usage

ScriptInvonkers for certain events

 Event_OnStarted () = new ScriptInvoker()
 Event used when Start was called. More...
 
ref ScriptInvoker Event_OnStopped () = new ScriptInvoker()
 Event used when Stop was called. More...
 
ref ScriptInvoker Event_OnEffectStarted () = new ScriptInvoker()
 Event used when the actual effect started playing. More...
 
ref ScriptInvoker Event_OnEffectEnded () = new ScriptInvoker()
 Event used when the actual effect stopped playing. More...
 
Generic data

Generic data for the Effect

protected bool m_IsAutodestroy
 Whether the Effect cleans up after itself when stopped. More...
 
protected bool m_IsPendingDeletion
 Whether the Destroy process has already been called. More...
 
protected bool m_IsPlaying
 Whether the Effect is currently playing. More...
 
protected Object m_ParentObject
 Cached parent. More...
 
protected vector m_Position
 Cached world position. More...
 
SEffectManager data

Data filled in by SEffectManager to identify it when it is registered

protected int m_ID
 ID of effect, given by SEffectManager when registered (automatically done when playing through it) More...
 
protected bool m_IsRegistered
 Whether the effect is registered in SEffectManager. More...
 

Attachment data

Cached settings set through 'SetAttachment...' methods Does not necessarily reflect the current state when EffectParticle

protected vector m_LocalPos
 Cached local pos. More...
 
protected vector m_LocalOri
 Local orientation set by SetAttachedLocalOri, only used by EffectParticle. More...
 
void Effect ()
 ctor More...
 
void ~Effect ()
 dtor More...
 
void InitEffect ()
 init More...
 

Enumeration Type Documentation

◆ EffectType

enum EffectType

Enum to determine what type of effect the Effect is.

Definition at line 2 of file effect.c.

Function Documentation

◆ Effect()

void Effect ( )

ctor

Definition at line 70 of file effect.c.

◆ Event_OnFrameUpdate()

void Event_OnFrameUpdate ( float  time_delta)

Event called on frame when enabled by SetEnableEventFrame(true)

Note
Called from SEffectManager.Event_OnFrameUpdate in MissionGameplay.OnUpdate
Parameters
time_deltafloat Time passed since the previous frame

Definition at line 343 of file effect.c.

◆ Event_OnRegistered()

void Event_OnRegistered ( int  id)

Event called from SEffectManager when the Effect is registered.

Note
Should only ever be called by SEffectManager!
Parameters
idint ID registered in SEffectManager

Definition at line 353 of file effect.c.

◆ Event_OnUnregistered()

void Event_OnUnregistered ( )

Event called from SEffectManager when the Effect is unregistered.

Note
Should only ever be called by SEffectManager!

Definition at line 363 of file effect.c.

◆ GetAttachedLocalOri()

vector GetAttachedLocalOri ( )

Get the local orientation set by SetAttachedLocalOri.

Warning
Is not necessarily the current local orientation
Returns
vector The local orientation set by SetAttachedLocalOri

Definition at line 611 of file effect.c.

◆ GetAttachedLocalPos()

vector GetAttachedLocalPos ( )

Get the local pos set by SetAttachedLocalPos.

Returns
vector The local pos set by SetAttachedLocalPos

Definition at line 590 of file effect.c.

◆ GetAttachmentParent()

Object GetAttachmentParent ( )

Get the parent set by SetAttachmentParent.

Returns
Object The parent set by SetAttachmentParent

Definition at line 572 of file effect.c.

◆ GetCurrentLocalPosition()

vector GetCurrentLocalPosition ( )

Get the current local position of the managed effect.

Returns
vector The current local position of the managed effect

Definition at line 506 of file effect.c.

◆ GetCurrentParent()

Object GetCurrentParent ( )

Get the current parent of the managed Effect.

Returns
Object The current parent of the managed Effect

Definition at line 426 of file effect.c.

◆ GetCurrentPosition()

vector GetCurrentPosition ( )

Get the current world position of the managed effect.

Returns
vector The current world position of the managed effect

Definition at line 466 of file effect.c.

◆ GetEffectType()

EffectType GetEffectType ( )

Get what type of effect the Effect is.

Returns
EffectType What type of effect the Effect is

Definition at line 116 of file effect.c.

◆ GetID()

int GetID ( )

Get the ID registered in SEffectManager.

Returns
int ID registered in SEffectManager, or 0 (SEffectManager.INVALID_ID) when not registered

Definition at line 534 of file effect.c.

◆ GetLocalPosition()

vector GetLocalPosition ( )

Get the local position of the Effect.

Warning
Only gets the cached variable, for immediate effect use GetCurrent variant
Returns
vector The lcoal position of the Effect

Definition at line 486 of file effect.c.

◆ GetPosition()

vector GetPosition ( )

Get the world position of the Effect.

Warning
Only gets the cached variable, for immediate effect use GetCurrent variant
Returns
vector The world position of the Effect

Definition at line 446 of file effect.c.

◆ InitEffect()

void InitEffect ( )

init

Definition at line 99 of file effect.c.

◆ IsParticle()

bool IsParticle ( )

Check whether the Effect is EffectParticle without casting.

Returns
bool Whether the Effect is EffectParticle

Definition at line 134 of file effect.c.

◆ IsPlaying()

bool IsPlaying ( )

Returns true when the Effect is playing, false otherwise.

Definition at line 193 of file effect.c.

◆ IsRegistered()

bool IsRegistered ( )

Get whether this Effect is registered in SEffectManager.

Returns
bool Whether this Effect is registered in SEffectManager

Definition at line 543 of file effect.c.

◆ IsSound()

bool IsSound ( )

Check whether the Effect is EffectSound without casting.

Returns
bool Whether the Effect is EffectSound

Definition at line 125 of file effect.c.

◆ OnCheckUpdate()

void OnCheckUpdate ( )

Event used when EffectParticle.CheckLifeSpan was called (DEPRECATED)

Note
So this is EffectParticle specific...
EffectParticle.CheckLifeSpan is currently not in use

Definition at line 374 of file effect.c.

◆ SetAttachedLocalOri()

void SetAttachedLocalOri ( vector  ori)

Set local orientation for the Effectparticle to attach to when the Effect is started.

Warning
Only caches it into a variable to be used by Start, does not live update when called afterwards
Note
Overrides the orientation set by EffectParticle.SetOrientation
Parameters
orivector The local orientation to use on Start

Definition at line 601 of file effect.c.

◆ SetAttachedLocalPos()

void SetAttachedLocalPos ( vector  pos)

Set local pos for the Effect relative to the parent.

Parameters
posvector The local pos relative to the parent

Definition at line 581 of file effect.c.

◆ SetAttachmentParent()

void SetAttachmentParent ( Object  obj)

Set parent for the Effect.

Parameters
objObject The parent for the Effect

Definition at line 563 of file effect.c.

◆ SetCurrentLocalPosition()

void SetCurrentLocalPosition ( vector  pos,
bool  updateCached = true 
)

Set the current local position of the managed effect.

Parameters
posvector The current local position for the managed effect
updateCachedbool Whether to update the cached variable

Definition at line 496 of file effect.c.

◆ SetCurrentParent()

void SetCurrentParent ( Object  parent_obj,
bool  updateCached = true 
)

Set current parent of the managed effect.

Note
Same as SetAttachmentParent, but more generic name
Parameters
parent_objObject The parent for the Effect
updateCachedbool Whether to update the cached variable

Definition at line 416 of file effect.c.

◆ SetCurrentPosition()

void SetCurrentPosition ( vector  pos,
bool  updateCached = true 
)

Set the current world position of the managed effect.

Parameters
posvector The current world position for the Effect
updateCachedbool Whether to update the cached variable

Definition at line 456 of file effect.c.

◆ SetID()

protected void SetID ( int  id)

Set the ID registered in SEffectManager.

Note
Should only ever be called by Event_OnRegistered!
Parameters
idint ID registered in SEffectManager

Definition at line 525 of file effect.c.

◆ SetLocalPosition()

void SetLocalPosition ( vector  pos)

Set the local position of the Effect.

Warning
Only sets the cached variable, for immediate effect use SetCurrent variant
Parameters
posvector The local position for the Effect

Definition at line 476 of file effect.c.

◆ SetParent()

void SetParent ( Object  parent_obj)

Set parent of the Effect.

Note
Same as SetAttachmentParent, but more generic name
Warning
Only sets the cached variable, for immediate effect use SetCurrent variant
Parameters
parent_objObject The parent for the Effect

Definition at line 394 of file effect.c.

◆ Start()

void Start ( )

Plays all elements this effects consists of.

Note
Is called by SEffectManager.Play methods

Definition at line 153 of file effect.c.

◆ Stop()

void Stop ( )

Stops all elements this effect consists of.

Note
Alternatively use SEffectManager.Stop( effect_id )

Definition at line 179 of file effect.c.

◆ ValidateStart()

void ValidateStart ( )

Validation whether an effect truly started playing or if the Effect should stop as none is present.

Note
Override this when inheriting to create own validation check
Is called from Event_OnStarted invoker after Event_OnStarted has been performed

Definition at line 170 of file effect.c.

◆ ~Effect()

void ~Effect ( )

dtor

Definition at line 83 of file effect.c.

Variable Documentation

◆ Event_OnEffectEnded

void Event_OnEffectEnded = new ScriptInvoker()

Event used when the actual effect stopped playing.

Definition at line 25 of file effect.c.

◆ Event_OnEffectStarted

void Event_OnEffectStarted = new ScriptInvoker()

Event used when the actual effect started playing.

Definition at line 24 of file effect.c.

◆ Event_OnStarted

void Event_OnStarted = new ScriptInvoker()

Event used when Start was called.

Definition at line 300 of file effect.c.

◆ Event_OnStopped

void Event_OnStopped = new ScriptInvoker()

Event used when Stop was called.

Definition at line 23 of file effect.c.

◆ m_ID

protected int m_ID

ID of effect, given by SEffectManager when registered (automatically done when playing through it)

Definition at line 49 of file effect.c.

◆ m_IsAutodestroy

protected bool m_IsAutodestroy

Whether the Effect cleans up after itself when stopped.

Definition at line 33 of file effect.c.

◆ m_IsPendingDeletion

protected bool m_IsPendingDeletion

Whether the Destroy process has already been called.

Definition at line 35 of file effect.c.

◆ m_IsPlaying

protected bool m_IsPlaying

Whether the Effect is currently playing.

Definition at line 37 of file effect.c.

◆ m_IsRegistered

protected bool m_IsRegistered

Whether the effect is registered in SEffectManager.

Definition at line 51 of file effect.c.

◆ m_LocalOri

protected vector m_LocalOri

Local orientation set by SetAttachedLocalOri, only used by EffectParticle.

Definition at line 62 of file effect.c.

◆ m_LocalPos

protected vector m_LocalPos

Cached local pos.

Definition at line 60 of file effect.c.

◆ m_ParentObject

protected Object m_ParentObject

Cached parent.

Definition at line 39 of file effect.c.

◆ m_Position

protected vector m_Position

Cached world position.

Definition at line 41 of file effect.c.

◆ NONE

@ NONE

Plain Effect base.

Definition at line 20 of file effect.c.

◆ PARTICLE

PARTICLE

EffectParticle.

Definition at line 24 of file effect.c.

◆ SOUND

SOUND

EffectSound.

Definition at line 22 of file effect.c.