53enum ParticlePropertiesFlags
65class ParticleProperties
180 int flags = ParticlePropertiesFlags.NONE;
184 flags = flags | ParticlePropertiesFlags.PLAY_ON_CREATION;
187 if (forceWorldRotation)
189 flags = flags | ParticlePropertiesFlags.FORCE_WORLD_ROT;
208 if (particlePath ==
"")
210 ErrorEx(
string.Format(
"Could not create ParticleSource as particle id %1 is invalid.",
id));
217 pos = parent.GetPosition();
221 ParticleProperties props =
new ParticleProperties(localPos, flags, parent, ori, owner);
239 vector local_pos =
"0 0 0",
240 vector local_ori =
"0 0 0",
241 bool force_world_rotation =
false )
726 super.OnParticleParented(parent);
749 super.OnParticleUnParented(parent);
763 super.OnParticleStop();
785 int flags = ParticlePropertiesFlags.NONE;
787 if (force_rotation_to_world)
788 flags = ParticlePropertiesFlags.FORCE_WORLD_ROT;
790 ParticleProperties props =
new ParticleProperties(local_pos, flags, parent, local_ori);
830 override void GetParameter(
int emitter,
int parameter, out
float value)
856 for (
int i = 0; i < emitors; ++i)
872 for (
int i = 0; i < emitors; ++i)
889 for (
int i = 0; i < emitors; ++i)
906 for (
int i = 0; i < emitors; ++i)
929 override void SetWiggle(
float random_angle,
float random_interval)
931 if (random_angle != 0 || random_interval != 0)
954 super.SetWiggle(random_angle, random_interval);
969 int flags = ParticlePropertiesFlags.NONE;
972 flags = ParticlePropertiesFlags.FORCE_WORLD_ROT;
992 int flags = ParticlePropertiesFlags.NONE;
995 flags = ParticlePropertiesFlags.FORCE_WORLD_ROT;
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.
float m_MaxOriWiggle
Used for Wiggle API, Wiggle room [-m_MaxOriWiggle, m_MaxOriWiggle].
bool IsWiggling()
Checks if particle is currently wiggling.
vector m_DefaultOri
Used for Wiggle API, to restore after unparenting.
vector m_DefaultPos
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.
float m_MaxOriInterval
Used for Wiggle API, Interval for wiggling [0, m_MaxOriInterval[.
protected Object m_ParticleEffect
The child object which contains the actual particle.
protected vector RandWiggleVector()
Helper to get a randomized wiggle vector.
protected Object m_ParentObject
Parent Object the Particle is child of.
bool m_ForceOrientationRelativeToWorld
Used for Wiggle API, to restore after unparenting.
vector m_DefaultWorldOri
Used for Wiggle API, to restore after unparenting.
ref Timer m_RandomizeOri
Used for Wiggle API, calls the Wiggle functionality.
static string GetParticleFullPath(int particle_id)
Returns particle's full path (with .ptc suffix) based on its ID.
static int GetParticleIDByName(string name)
Returns particle's ID based on the filename (without .ptc suffix)
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 Object GetDirectParticleEffect()
Returns direct particle effect entity.
private proto bool HasActiveParticleNative()
Returns if there is any particle active.
override bool IsRepeat()
Returns whether there is a repeating particle.
override void IncrementParticleParamFromOriginal(int parameter_id, float value)
Increments the value of the given parameter relatively from the ORIGINAL value.
override bool RestartParticle()
Method to tell the particle to restart (reset + play)
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 private void CreateParticleEffect()
Empty.
static override Particle Play(int particle_id, vector global_pos)
Legacy function for backwards compatibility with 1.01 and below.
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.
override void StopWiggle()
Stops randomized wiggle.
override void IncrementParticleParam(int parameter_id, float value)
Increments the value of the given parameter relatively from the CURRENT value.
override protected void OnParticleParented(IEntity parent)
Event when the particle receives a parent.
override void SetParameter(int emitter, int parameter, float value)
Set the value of a parameter of an emitor in the particle.
private proto native bool RestartParticleNative()
Method to tell the particle to restart (reset + play)
override int GetParticleID()
Gets the ParticleList ID of the currently assigned particle.
proto native Class GetOwner()
Get the owner of this ParticleSource.
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 float GetMaxLifetime()
Returns the approx. max lifetime.
proto static native int GetStaticActiveCount()
Gets the amount of ParticleSource that are currently existing.
override void SetParticleParam(int parameter_id, float value)
Set the value of a parameter of all emitors in the particle.
bool ApplyProperties(ParticleProperties properties)
Applies the properties given to the ParticleSource
override bool ResetParticle()
Method to tell the particle to reset.
bool GetParticle(out string path, EGetParticleMode mode)
Gets the path to the currently assigned particle.
override private void RandomizeOrientation()
Randomizes a new orientation and applies it.
proto native int GetIndex()
Get the index of this ParticleSource in the owning ParticleManager.
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.
proto int GetCountID()
Gets the ID for the ParticleSource.
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.
override void ScaleParticleParam(int parameter_id, float coef)
Scales the given parameter on all emitors relatively to their CURRENT value.
private proto bool GetParticleNative(out string path, EGetParticleMode mode)
Gets the path to the currently assigned particle.
override bool HasActiveParticle()
Returns if there is any particle active.
int GetParticleIDLegacy()
Gets the ParticleList ID of the currently assigned particle.
static ParticleSource CreateParticleEx(int id, vector pos, int flags=ParticlePropertiesFlags.NONE, Object parent=null, vector ori=vector.Zero, Class owner=null)
Master create function.
proto native int GetParticleAutoDestroyFlags()
Gets the currently set ParticleAutoDestroyFlags flags set on this ParticleSource.
override void ScaleParticleParamFromOriginal(int parameter_id, float coef)
Scales the given parameter on all emitors relatively to their ORIGINAL value.
private proto bool PlayParticleNative(int flags)
Method to tell the particle to start playing.
void DisableAutoDestroy()
Disables the particle automatically cleaning up itself when ending or stopping.
override void GetParameter(int emitter, int parameter, out float value)
Get the value of a parameter of an emitor in the particle.
override bool PlayParticleEx(int particle_id=-1, int flags=0)
Method to tell the particle to start playing.
override void SetWiggle(float random_angle, float random_interval)
Makes the particle change direction by random_angle every random_interval seconds.
private bool SetParticle(string path)
Assigns a particle to the ParticleSource.
override void SetSource(int particle_id)
Sets particle id.
proto native void SetParticleAutoDestroyFlags(ParticleAutoDestroyFlags flags)
Enables the particle to automatically clean up itself when ending or stopping.
private proto native bool ApplyPropertiesNative(ParticleProperties properties)
Applies the properties given to the ParticleSource.
override private void DestroyParticleEffect()
Empty.
bool SetParticleByID(int id)
Assigns a particle to the ParticleSource.
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.
private proto int GetParticleCountNative()
Returns the total count of active particles in all emitors.
override private void OnCheckAutoDelete()
Empty.
private proto bool IsParticlePlayingNative()
Ask if the particle is still playing.
proto native void SetOwner(Class owner)
Set the owner of this ParticleSource.
static override Particle PlayInWorld(int particle_id, vector global_pos)
Creates a particle emitter on the given position and activates it.
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 protected void ParticleInit()
Empty - Only needed for Particle.
override bool IsParticlePlaying()
Ask if the particle is still playing.
override float GetParameterEx(int emitter, int parameter)
Get the value of a parameter of an emitor in the particle.
proto native void Orphan()
null the owner of this ParticleSource
private proto bool StopParticleNative(int flags)
Method to tell the particle to stop playing.
void ~ParticleSource()
dtor
override private void OnToDelete()
Empty.
private proto native bool SetParticleNative(string path)
Assigns a particle to the ParticleSource.
override protected void EOnFrame(IEntity other, float timeSlice)
Empty.
override int GetParticleCount()
Returns the total count of active particles in all emitors.
override protected void OnParticleUnParented(IEntity parent)
Event when the particle is orphaned.
private proto native bool ResetParticleNative()
Method to tell the particle to reset.
proto static native int GetStaticCount()
Gets the amount of ParticleSource that have been created since the start of the program.
proto native ParticleManager GetParticleManager()
Get the ParticleManager the ParticleSource belongs to if any.
private proto bool IsRepeatNative()
Returns whether there is a repeating particle.
void ParticleSource()
ctor
override private void UpdateState()
Empty.
override bool StopParticle(int flags=0)
Method to tell the particle to stop playing.
override protected void OnParticleStop()
Event when the particle stops.
override Object GetParticleParent()
Returns the parent of this Particle if there is one.
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.
private proto float GetMaxLifetimeNative()
Returns the approx. max lifetime.
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
proto vector GetLocalPos()
proto bool IsKeepParentOnEnd()
proto bool IsPlayOnCreation()
void ~ParticleProperties()
dtor
void ParticleProperties(vector localPos, int flags, Object parent=null, vector localOri=vector.Zero, Class owner=null)
Constructor (ctor)
proto bool IsForceWorldRotation()
proto vector GetLocalOri()
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)