Dayz Explorer 1.28.160049
Loading...
Searching...
No Matches
SEffectManager Class Reference

Manager class for managing Effect (EffectParticle, EffectSound) More...

Static Protected Member Functions

Generic playback

Methods for playing Effect

Note
Since 1.15, these should work on EffectSound as well
static int PlayInWorld (notnull Effect eff, vector pos)
 Play an Effect.
 
static int PlayOnObject (notnull Effect eff, Object obj, vector local_pos="0 0 0", vector local_ori="0 0 0", bool force_rotation_relative_to_world=false)
 Play an Effect.
 
static void Stop (int effect_id)
 Stops the Effect.
 
Create/Play sound

Methods for playing/creating sound

static EffectSound CreateSound (string sound_set, vector position, float play_fade_in=0, float stop_fade_out=0, bool loop=false, bool enviroment=false)
 Create an EffectSound.
 
static EffectSound PlaySound (string sound_set, vector position, float play_fade_in=0, float stop_fade_out=0, bool loop=false)
 Create and play an EffectSound.
 
static EffectSound PlaySoundParams (notnull SoundParams params, vector position, float play_fade_in=0, float stop_fade_out=0, bool loop=false)
 Create and play an EffectSound.
 
static EffectSound PlaySoundCachedParams (string sound_set, vector position, float play_fade_in=0, float stop_fade_out=0, bool loop=false)
 Create and play an EffectSound, using or creating cached SoundParams.
 
static EffectSound PlaySoundEnviroment (string sound_set, vector position, float play_fade_in=0, float stop_fade_out=0, bool loop=false)
 Create and play an EffectSound, updating environment variables.
 
static EffectSound PlaySoundOnObject (string sound_set, Object parent_object, float play_fade_in=0, float stop_fade_out=0, bool loop=false)
 Create and play an EffectSound.
 
Generic API

General methods used for SEffectManager

static void DestroyEffect (Effect effect)
 Unregisters, stops and frees the Effect.
 
static bool IsEffectExist (int effect_id)
 Checks whether an Effect ID is registered in SEffectManager.
 
static Effect GetEffectByID (int effect_id)
 Gets the Effect with the given registered Effect ID.
 
static int EffectRegister (Effect effect)
 Registers Effect in SEffectManager.
 
static int GetFreeEffecterID ()
 
static void EffectUnregister (int id)
 Unregisters Effect in SEffectManager.
 
static void EffectUnregisterEx (Effect effect)
 Unregisters Effect in SEffectManager.
 
static int GetFreeEffectID ()
 Helper function for EffectRegister to decide an Effect ID.
 
Sound helpers

Sound specific helper methods

static bool DestroySound (EffectSound sound_effect)
 Legacy, backwards compatibility.
 
static SoundParams GetCachedSoundParam (string soundset)
 Get or create a cached SoundParams object.
 
Events

Various events that can be overriden for custom behaviour

static void Event_OnSoundWaveEnded (EffectSound effect_sound)
 Event called from EffectSound.Event_OnSoundWaveEnded.
 
static void Event_OnFrameUpdate (float time_delta)
 Event called on frame.
 
Lifetime

Creation and cleanup

static void Init ()
 Initialize the containers.
 
static void InitServer ()
 
static void Cleanup ()
 Cleanup method to properly clean up the static data.
 
static int CreateParticleServer (vector pos, EffecterParameters parameters)
 returns unique effecter ID
 
static void ReinitParticleServer (int effecterID, EffecterParameters parameters)
 allows re-initializing existing effecter with new parameters (extept m_EffecterType, obviously)
 
static void ReactivateParticleServer (int effecterID)
 
static void StartParticleServer (int effecterID)
 
static void StopParticleServer (int effecterID)
 
static void DestroyEffecterParticleServer (int effecterID)
 
static void OnUpdate (float timeslice)
 

Static Protected Attributes

static ref map< int, ref Effectm_EffectsMap
 Static map of all registered effects <id, Effect>
 
static ref array< intm_FreeEffectIDs
 Static array of IDs that were previously used, but freed up by unregistering.
 
static int m_HighestFreeEffectID = 1
 Counter for quickly getting the next ID if FreeEffectIDs array is empty.
 
static const int INVALID_ID = 0
 As the counter starts at 1, Effect ID can never be 0.
 
static bool m_IsCleanup
 Bool to check whether Cleanup is happening, which means that the maps should no longer be accessed.
 
static bool m_IsInitialized
 Bool to check whether Init was called.
 
static ref map< string, ref SoundParamsm_ParamsMap
 Static map of cached sound params, to prevent having to recreate them.
 
static ref ScriptInvoker Event_OnFrameUpdate
 Static invoker for the SEffectManager.Event_OnFrameUpdate called form MissionGameplay.OnUpdate.
 
static ref map< int, EffecterBasem_EffectersMap
 
static ref array< intm_FreeEffecterIDs
 Static array of IDs that were previously used, but freed up by unregistering Effecters.
 
static int m_HighestFreeEffecterID = 1
 

Detailed Description

Manager class for managing Effect (EffectParticle, EffectSound)

Warning
Keeps a ref to any Effect registered (Created/Played), make sure to perform the necessary cleanup

Definition at line 5 of file effectmanager.c.

Member Function Documentation

◆ Cleanup()

static void SEffectManager::Cleanup ( )
staticprotected

Cleanup method to properly clean up the static data.

Note
Will be called when MissionBase is destroyed

Definition at line 518 of file effectmanager.c.

◆ CreateParticleServer()

static int SEffectManager::CreateParticleServer ( vector pos,
EffecterParameters parameters )
staticprotected

returns unique effecter ID

Definition at line 577 of file effectmanager.c.

◆ CreateSound()

static EffectSound SEffectManager::CreateSound ( string sound_set,
vector position,
float play_fade_in = 0,
float stop_fade_out = 0,
bool loop = false,
bool enviroment = false )
staticprotected

Create an EffectSound.

Warning
Read PlayInWorld warning
Parameters
sound_setstring The sound set name of the sound
positionvector The position to play the sound
play_fade_infloat The fade in duration of the sound (Optional)
stop_fade_outfloat The fade out duration of the sound (Optional)
loopbool Whether the sound should loop (Optional)
enviromentbool Whether to set environment variables (Optional)
Returns
EffectSound The created EffectSound

Definition at line 144 of file effectmanager.c.

◆ DestroyEffect()

static void SEffectManager::DestroyEffect ( Effect effect)
staticprotected

Unregisters, stops and frees the Effect.

Parameters
effect_soundEffectSound The EffectSound to free

Definition at line 271 of file effectmanager.c.

◆ DestroyEffecterParticleServer()

static void SEffectManager::DestroyEffecterParticleServer ( int effecterID)
staticprotected

Definition at line 630 of file effectmanager.c.

◆ DestroySound()

static bool SEffectManager::DestroySound ( EffectSound sound_effect)
staticprotected

Legacy, backwards compatibility.

Parameters
sound_effectEffectSound The EffectSound to free
Returns
bool A bool which is always true

Definition at line 432 of file effectmanager.c.

◆ EffectRegister()

static int SEffectManager::EffectRegister ( Effect effect)
staticprotected

Registers Effect in SEffectManager.

Note
Already handled in SEffectManager Create/Play methods
This will make SEffectManager hold a strong ref for the Effect
Parameters
effectEffect The Effect to register
Returns
int The Effect ID

Definition at line 322 of file effectmanager.c.

◆ EffectUnregister()

static void SEffectManager::EffectUnregister ( int id)
staticprotected

Unregisters Effect in SEffectManager.

Note
Will automatically occur on stop when the Effect is AutoDestroy
ID can be gotten from the Effect by calling Effect.GetID
Generic Play methods will also return the ID
Parameters
idint The ID of the Effect to unregister

Definition at line 369 of file effectmanager.c.

◆ EffectUnregisterEx()

static void SEffectManager::EffectUnregisterEx ( Effect effect)
staticprotected

Unregisters Effect in SEffectManager.

Parameters
effectEffect The Effect to unregister

Definition at line 391 of file effectmanager.c.

◆ Event_OnFrameUpdate()

static void SEffectManager::Event_OnFrameUpdate ( float time_delta)
staticprotected

Event called on frame.

Note
Called from MissionGameplay.OnUpdate
Effects register themselves by Effect.SetEnableEventFrame(true)
EffectSound is automatically registered
Parameters
time_deltafloat Time passed since the previous frame

Definition at line 480 of file effectmanager.c.

◆ Event_OnSoundWaveEnded()

static void SEffectManager::Event_OnSoundWaveEnded ( EffectSound effect_sound)
staticprotected

Event called from EffectSound.Event_OnSoundWaveEnded.

Note
Every registered sound is registered to call this
Parameters
effect_soundEffectSound The EffectSound calling the event

Definition at line 468 of file effectmanager.c.

◆ GetCachedSoundParam()

static SoundParams SEffectManager::GetCachedSoundParam ( string soundset)
staticprotected

Get or create a cached SoundParams object.

Parameters
soundsetstring The sound set name of the sound
Returns
SoundParams The cached SoundParams for the given soundset

Definition at line 443 of file effectmanager.c.

◆ GetEffectByID()

static Effect SEffectManager::GetEffectByID ( int effect_id)
staticprotected

Gets the Effect with the given registered Effect ID.

Parameters
effect_idint The Effect ID
Returns
Effect The Effect registered to the ID or null

Definition at line 307 of file effectmanager.c.

◆ GetFreeEffecterID()

static int SEffectManager::GetFreeEffecterID ( )
staticprotected

Definition at line 344 of file effectmanager.c.

◆ GetFreeEffectID()

static int SEffectManager::GetFreeEffectID ( )
staticprotected

Helper function for EffectRegister to decide an Effect ID.

Returns
int A currently unused Effect ID

Definition at line 400 of file effectmanager.c.

◆ Init()

static void SEffectManager::Init ( )
staticprotected

Initialize the containers.

Note
This is done this way, to have these not exist on server

Definition at line 498 of file effectmanager.c.

◆ InitServer()

static void SEffectManager::InitServer ( )
staticprotected

Definition at line 508 of file effectmanager.c.

◆ IsEffectExist()

static bool SEffectManager::IsEffectExist ( int effect_id)
staticprotected

Checks whether an Effect ID is registered in SEffectManager.

Parameters
effect_idint The Effect ID to check
Returns
bool Whether there is an Effect registered for this ID

Definition at line 294 of file effectmanager.c.

◆ OnUpdate()

static void SEffectManager::OnUpdate ( float timeslice)
staticprotected

Definition at line 640 of file effectmanager.c.

◆ PlayInWorld()

static int SEffectManager::PlayInWorld ( notnull Effect eff,
vector pos )
staticprotected

Play an Effect.

Warning
As the Effect is automatically registered, it will not be freed automatically (because of the ref) Unless 'SetAutodestroy(true)' is called on the created 'Effect', which will clean it up when the sound stop Alternatively, SEffectManager.DestroyEffect can be called manually, which will also unregister and cleanup
Parameters
effEffect The Effect to play
posvector The position to play the Effect
Returns
int The registered ID of the Effect

Definition at line 47 of file effectmanager.c.

◆ PlayOnObject()

static int SEffectManager::PlayOnObject ( notnull Effect eff,
Object obj,
vector local_pos = "0 0 0",
vector local_ori = "0 0 0",
bool force_rotation_relative_to_world = false )
staticprotected

Play an Effect.

Warning
Read PlayInWorld warning
Parameters
effEffect The Effect to play
objObject The parent of the Effect
local_posvector The local position to play the Effect in relation to the parent (Optional)
local_orivector The local orientation to play the Effect in relation to the parent (Optional)
force_rotation_relative_to_worldbool Whether to force the orientation to stay in WS (Optional)
Returns
int The registered ID of the Effect

Definition at line 70 of file effectmanager.c.

◆ PlaySound()

static EffectSound SEffectManager::PlaySound ( string sound_set,
vector position,
float play_fade_in = 0,
float stop_fade_out = 0,
bool loop = false )
staticprotected

Create and play an EffectSound.

Warning
Calls CreateSound, read CreateSound warning
Parameters
sound_setstring The sound set name of the sound
positionvector The position to play the sound
play_fade_infloat The fade in duration of the sound (Optional)
stop_fade_outfloat The fade out duration of the sound (Optional)
loopbool Whether the sound should loop (Optional)
Returns
EffectSound The created EffectSound

Definition at line 169 of file effectmanager.c.

◆ PlaySoundCachedParams()

static EffectSound SEffectManager::PlaySoundCachedParams ( string sound_set,
vector position,
float play_fade_in = 0,
float stop_fade_out = 0,
bool loop = false )
staticprotected

Create and play an EffectSound, using or creating cached SoundParams.

Warning
Calls CreateSound, read CreateSound warning
Parameters
sound_setstring The sound set name of the sound
positionvector The position to play the sound
play_fade_infloat The fade in duration of the sound (Optional)
stop_fade_outfloat The fade out duration of the sound (Optional)
loopbool Whether the sound should loop (Optional)
Returns
EffectSound The created EffectSound

Definition at line 207 of file effectmanager.c.

◆ PlaySoundEnviroment()

static EffectSound SEffectManager::PlaySoundEnviroment ( string sound_set,
vector position,
float play_fade_in = 0,
float stop_fade_out = 0,
bool loop = false )
staticprotected

Create and play an EffectSound, updating environment variables.

Warning
Calls CreateSound, read CreateSound warning
Parameters
sound_setstring The sound set name of the sound
positionvector The position to play the sound
play_fade_infloat The fade in duration of the sound (Optional)
stop_fade_outfloat The fade out duration of the sound (Optional)
loopbool Whether the sound should loop (Optional)
Returns
EffectSound The created EffectSound

Definition at line 228 of file effectmanager.c.

◆ PlaySoundOnObject()

static EffectSound SEffectManager::PlaySoundOnObject ( string sound_set,
Object parent_object,
float play_fade_in = 0,
float stop_fade_out = 0,
bool loop = false )
staticprotected

Create and play an EffectSound.

Warning
Calls CreateSound, read CreateSound warning
Parameters
sound_setstring The sound set name of the sound
parent_objectObject The parent Object for the sound to follow
play_fade_infloat The fade in duration of the sound (Optional)
stop_fade_outfloat The fade out duration of the sound (Optional)
loopbool Whether the sound should loop (Optional)
Returns
EffectSound The created EffectSound

Definition at line 247 of file effectmanager.c.

◆ PlaySoundParams()

static EffectSound SEffectManager::PlaySoundParams ( notnull SoundParams params,
vector position,
float play_fade_in = 0,
float stop_fade_out = 0,
bool loop = false )
staticprotected

Create and play an EffectSound.

Warning
Calls CreateSound, read CreateSound warning
Parameters
paramsSoundParams Params to create the sound with
positionvector The position to play the sound
play_fade_infloat The fade in duration of the sound (Optional)
stop_fade_outfloat The fade out duration of the sound (Optional)
loopbool Whether the sound should loop (Optional)
Returns
EffectSound The created EffectSound

Definition at line 188 of file effectmanager.c.

◆ ReactivateParticleServer()

static void SEffectManager::ReactivateParticleServer ( int effecterID)
staticprotected

Definition at line 602 of file effectmanager.c.

◆ ReinitParticleServer()

static void SEffectManager::ReinitParticleServer ( int effecterID,
EffecterParameters parameters )
staticprotected

allows re-initializing existing effecter with new parameters (extept m_EffecterType, obviously)

Definition at line 593 of file effectmanager.c.

◆ StartParticleServer()

static void SEffectManager::StartParticleServer ( int effecterID)
staticprotected

Definition at line 611 of file effectmanager.c.

◆ Stop()

static void SEffectManager::Stop ( int effect_id)
staticprotected

Stops the Effect.

Parameters
effect_idint The ID of the Effect to Stop

Definition at line 110 of file effectmanager.c.

◆ StopParticleServer()

static void SEffectManager::StopParticleServer ( int effecterID)
staticprotected

Definition at line 621 of file effectmanager.c.

Member Data Documentation

◆ Event_OnFrameUpdate

ref ScriptInvoker SEffectManager::Event_OnFrameUpdate
staticprotected

Static invoker for the SEffectManager.Event_OnFrameUpdate called form MissionGameplay.OnUpdate.

Definition at line 24 of file effectmanager.c.

◆ INVALID_ID

const int SEffectManager::INVALID_ID = 0
staticprotected

As the counter starts at 1, Effect ID can never be 0.

Definition at line 14 of file effectmanager.c.

◆ m_EffectersMap

ref map<int, EffecterBase> SEffectManager::m_EffectersMap
staticprotected

Definition at line 26 of file effectmanager.c.

◆ m_EffectsMap

ref map<int, ref Effect> SEffectManager::m_EffectsMap
staticprotected

Static map of all registered effects <id, Effect>

Definition at line 8 of file effectmanager.c.

◆ m_FreeEffecterIDs

ref array<int> SEffectManager::m_FreeEffecterIDs
staticprotected

Static array of IDs that were previously used, but freed up by unregistering Effecters.

Definition at line 28 of file effectmanager.c.

◆ m_FreeEffectIDs

ref array<int> SEffectManager::m_FreeEffectIDs
staticprotected

Static array of IDs that were previously used, but freed up by unregistering.

Definition at line 10 of file effectmanager.c.

◆ m_HighestFreeEffecterID

int SEffectManager::m_HighestFreeEffecterID = 1
staticprotected

Definition at line 30 of file effectmanager.c.

◆ m_HighestFreeEffectID

int SEffectManager::m_HighestFreeEffectID = 1
staticprotected

Counter for quickly getting the next ID if FreeEffectIDs array is empty.

Definition at line 12 of file effectmanager.c.

◆ m_IsCleanup

bool SEffectManager::m_IsCleanup
staticprotected

Bool to check whether Cleanup is happening, which means that the maps should no longer be accessed.

Definition at line 16 of file effectmanager.c.

◆ m_IsInitialized

bool SEffectManager::m_IsInitialized
staticprotected

Bool to check whether Init was called.

Definition at line 18 of file effectmanager.c.

◆ m_ParamsMap

ref map<string, ref SoundParams> SEffectManager::m_ParamsMap
staticprotected

Static map of cached sound params, to prevent having to recreate them.

Definition at line 21 of file effectmanager.c.


The documentation for this class was generated from the following file: