65class ParticleProperties
206 ErrorEx(
string.Format(
"Could not create ParticleSource as particle id %1 is invalid.",
id));
213 pos = parent.GetPosition();
713 super.OnParticleParented(parent);
736 super.OnParticleUnParented(parent);
750 super.OnParticleStop();
vector GetLocalPosition()
Get the local position of the Effect.
void ParticleManager(ParticleManagerSettings settings)
Constructor (ctor)
enum ParticleAutoDestroyFlags IMMEDIATE
Flag will make the particle stop immediately, taking it out of simulation and clearing VISIBLE flag.
enum ParticleAutoDestroyFlags VISIBLE
Is default behaviour, but can be used in conjuction with IMMEDIATE which hides it when this flag is n...
enum ParticleAutoDestroyFlags PLAY_ON_CREATION
Makes the particle start playing immediately after being created.
enum ParticleAutoDestroyFlags FILE
Filename only ("smoking_barrel_small")
ParticleAutoDestroyFlags
Flags to pass to ParticleSource.SetParticleAutoDestroyFlags.
@ ON_END
Destroy when the Particle ends (looping particle never ends)
@ ON_STOP
Destroy when particle stops.
enum ParticleAutoDestroyFlags PAUSE
(SPF_IMMEDIATE | SPF_VISIBLE) "Freezes" the particle while keeping it visible
enum ParticleAutoDestroyFlags FULL
Mode for GetParticle.
array< ParticleSource > ParticleSourceArray
enum ParticleAutoDestroyFlags RESET
Reset state after stopping.
enum ParticleAutoDestroyFlags NO_EXT
Full path without ext ("graphics/particles/smoking_barrel_small")
enum ParticleAutoDestroyFlags NONE
Flags to pass to ParticleSource.PlayParticleEx.
enum ParticleAutoDestroyFlags KEEP_PARENT_ON_END
By default, a particle unparents when it ends, this disables this behaviour.
enum ParticleAutoDestroyFlags FORCE_WORLD_ROT
Only applicable when there is a parent, this will force the localOri to be in world space instead of ...
Super root of all classes in Enforce script.
Legacy way of using particles in the game.
vector m_DefaultPos
Used for Wiggle API, to restore after unparenting.
Object m_ParticleEffect
The child object which contains the actual particle.
vector m_DefaultWorldOri
Used for Wiggle API, to restore after unparenting.
vector m_DefaultOri
Used for Wiggle API, to restore after unparenting.
bool m_ForceOrientationRelativeToWorld
Used for Wiggle API, to restore after unparenting.
bool m_WiggleProcessing
Used for Wiggle API, to signal that wiggle API is currently doing work.
vector m_DefaultWorldPos
Used for Wiggle API, to restore after unparenting.
vector RandWiggleVector()
Helper to get a randomized wiggle vector.
Object m_ParentObject
Parent Object the Particle is child of.
float m_MaxOriWiggle
Used for Wiggle API, Wiggle room [-m_MaxOriWiggle, m_MaxOriWiggle].
float m_MaxOriInterval
Used for Wiggle API, Interval for wiggling [0, m_MaxOriInterval[.
ref Timer m_RandomizeOri
Used for Wiggle API, calls the Wiggle functionality.
bool IsWiggling()
Checks if particle is currently wiggling.
static int GetParticleIDByName(string name)
Returns particle's ID based on the filename (without .ptc suffix)
static string GetParticleFullPath(int particle_id)
Returns particle's full path (with .ptc suffix) based on its ID.
static int GetParticleID(string particle_file)
Returns particle's ID based on the path (without .ptc suffix)
Entity which has the particle instance as an ObjectComponent.
override void IncrementParticleParam(int parameter_id, float value)
Increments the value of the given parameter relatively from the CURRENT value.
static override Particle Play(int particle_id, Object parent_obj, vector local_pos="0 0 0", vector local_ori="0 0 0")
Legacy function for backwards compatibility with 1.01 and below.
proto int GetCountID()
Gets the ID for the ParticleSource.
override void ScaleParticleParamFromOriginal(int parameter_id, float coef)
Scales the given parameter on all emitors relatively to their ORIGINAL value.
void ParticleSource()
ctor
proto float GetMaxLifetimeNative()
Returns the approx. max lifetime.
proto bool HasActiveParticleNative()
Returns if there is any particle active.
static override Particle CreateInWorld(int particle_id, vector global_pos, vector global_ori="0 0 0", bool force_world_rotation=false)
Creates a particle emitter on the given position.
void RandomizeOrientation()
Randomizes a new orientation and applies it.
override int GetParticleCount()
Returns the total count of active particles in all emitors.
override float GetMaxLifetime()
Returns the approx. max lifetime.
void OnCheckAutoDelete()
Empty.
static override Particle PlayOnObject(int particle_id, Object parent_obj, vector local_pos="0 0 0", vector local_ori="0 0 0", bool force_world_rotation=false)
Creates a particle emitter, attaches it on the given object and activates it.
static ParticleSource CreateParticleEx(int id, vector pos, int flags=ParticlePropertiesFlags.NONE, Object parent=null, vector ori=vector.Zero, Class owner=null)
Master create function.
void ParticleInit()
Empty - Only needed for Particle.
override bool StopParticle(int flags=0)
Method to tell the particle to stop playing.
proto native int GetIndex()
Get the index of this ParticleSource in the owning ParticleManager.
proto native bool SetParticleNative(string path)
Assigns a particle to the ParticleSource.
proto bool GetParticleNative(out string path, EGetParticleMode mode)
Gets the path to the currently assigned particle.
bool GetParticle(out string path, EGetParticleMode mode)
Gets the path to the currently assigned particle.
proto int GetParticleCountNative()
Returns the total count of active particles in all emitors.
static ParticleSource CreateParticle(int id, vector pos, bool playOnCreation=false, Object parent=null, vector ori=vector.Zero, bool forceWorldRotation=false, Class owner=null)
Create function.
override bool IsParticlePlaying()
Ask if the particle is still playing.
override 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...
override void SetParameter(int emitter, int parameter, float value)
Set the value of a parameter of an emitor in the particle.
static override Particle PlayInWorld(int particle_id, vector global_pos)
Creates a particle emitter on the given position and activates it.
proto native bool RestartParticleNative()
Method to tell the particle to restart (reset + play)
bool SetParticleByID(int id)
Assigns a particle to the ParticleSource.
int GetParticleIDLegacy()
Gets the ParticleList ID of the currently assigned particle.
override void StopWiggle()
Stops randomized wiggle.
static override Particle Create(int particle_id, Object parent_obj, vector local_pos="0 0 0", vector local_ori="0 0 0")
Legacy function for backwards compatibility.
static override Particle Play(int particle_id, vector global_pos)
Legacy function for backwards compatibility with 1.01 and below.
override void IncrementParticleParamFromOriginal(int parameter_id, float value)
Increments the value of the given parameter relatively from the ORIGINAL value.
bool ApplyProperties(ParticleProperties properties)
Applies the properties given to the ParticleSource.
proto bool IsParticlePlayingNative()
Ask if the particle is still playing.
override Object GetParticleParent()
Returns the parent of this Particle if there is one.
proto native Class GetOwner()
Get the owner of this ParticleSource.
override void SetSource(int particle_id)
Sets particle id.
override bool PlayParticleEx(int particle_id=-1, int flags=0)
Method to tell the particle to start playing.
static override ParticleSource Create(int particle_id, vector global_pos, vector global_ori="0 0 0")
Legacy function for backwards compatibility with 1.01 and below.
override float GetParameterEx(int emitter, int parameter)
Get the value of a parameter of an emitor in the particle.
proto native void SetOwner(Class owner)
Set the owner of this ParticleSource.
void ~ParticleSource()
dtor
proto static native int GetStaticActiveCount()
Gets the amount of ParticleSource that are currently existing.
proto native int GetParticleAutoDestroyFlags()
Gets the currently set ParticleAutoDestroyFlags flags set on this ParticleSource.
override bool HasActiveParticle()
Returns if there is any particle active.
void OnParticleParented(IEntity parent)
Event when the particle receives a parent.
proto native void SetParticleAutoDestroyFlags(ParticleAutoDestroyFlags flags)
Enables the particle to automatically clean up itself when ending or stopping.
void DestroyParticleEffect()
Empty.
override void SetWiggle(float random_angle, float random_interval)
Makes the particle change direction by random_angle every random_interval seconds.
void OnParticleUnParented(IEntity parent)
Event when the particle is orphaned.
override bool RestartParticle()
Method to tell the particle to restart (reset + play)
override Object GetDirectParticleEffect()
Returns direct particle effect entity.
static override Particle CreateOnObject(int particle_id, Object parent_obj, vector local_pos="0 0 0", vector local_ori="0 0 0", bool force_world_rotation=false)
Creates a particle emitter and attaches it on the given object.
override bool IsRepeat()
Returns whether there is a repeating particle.
void DisableAutoDestroy()
Disables the particle automatically cleaning up itself when ending or stopping.
proto native bool ApplyPropertiesNative(ParticleProperties properties)
Applies the properties given to the ParticleSource.
void OnParticleStop()
Event when the particle stops.
proto native void Orphan()
null the owner of this ParticleSource
override int GetParticleID()
Gets the ParticleList ID of the currently assigned particle.
bool SetParticle(string path)
Assigns a particle to the ParticleSource.
proto static native int GetStaticCount()
Gets the amount of ParticleSource that have been created since the start of the program.
void CreateParticleEffect()
Empty.
proto native ParticleManager GetParticleManager()
Get the ParticleManager the ParticleSource belongs to if any.
proto bool IsRepeatNative()
Returns whether there is a repeating particle.
proto bool StopParticleNative(int flags)
Method to tell the particle to stop playing.
override void ScaleParticleParam(int parameter_id, float coef)
Scales the given parameter on all emitors relatively to their CURRENT value.
proto bool PlayParticleNative(int flags)
Method to tell the particle to start playing.
proto native bool ResetParticleNative()
Method to tell the particle to reset.
override void GetParameter(int emitter, int parameter, out float value)
Get the value of a parameter of an emitor in the particle.
void EOnFrame(IEntity other, float timeSlice)
Empty.
override bool ResetParticle()
Method to tell the particle to reset.
override void SetParticleParam(int parameter_id, float value)
Set the value of a parameter of all emitors in the particle.
proto vector GetLocalPos()
proto vector GetLocalOri()
void ~ParticleProperties()
dtor
proto bool IsKeepParentOnEnd()
void ParticleProperties(vector localPos, int flags, Object parent=null, vector localOri=vector.Zero, Class owner=null)
Constructor (ctor)
proto bool IsPlayOnCreation()
proto bool IsForceWorldRotation()
proto native CGame GetGame()
static proto float RandomFloat(float min, float max)
Returns a random float number between and min[inclusive] and max[exclusive].
proto void SetParticleParm(notnull IEntity ent, int emitor, EmitorParam parameter, void value)
proto void GetParticleParmOriginal(notnull IEntity ent, int emitor, EmitorParam parameter, out void value)
proto int GetParticleEmitorCount(notnull IEntity ent)
proto void GetParticleParm(notnull IEntity ent, int emitor, EmitorParam parameter, out void value)