53enum ParticlePropertiesFlags
65class ParticleProperties
83 void ~ParticleProperties()
92 proto
Class GetOwner();
93 proto
vector GetLocalPos();
94 proto
vector GetLocalOri();
95 proto
int GetPPFlags();
96 proto
bool IsPlayOnCreation();
97 proto
bool IsForceWorldRotation();
98 proto
bool IsKeepParentOnEnd();
180 int flags = ParticlePropertiesFlags.NONE;
184 flags = flags | ParticlePropertiesFlags.PLAY_ON_CREATION;
187 if (forceWorldRotation)
189 flags = flags | ParticlePropertiesFlags.FORCE_WORLD_ROT;
207 string particlePath =
ParticleList.GetParticleFullPath(
id);
208 if (particlePath ==
"")
210 ErrorEx(
string.Format(
"Could not create ParticleSource as particle id %1 is invalid.",
id));
217 pos = parent.GetPosition();
220 p.SetParticle(particlePath);
221 ParticleProperties props =
new ParticleProperties(localPos, flags, parent, ori, owner);
222 p.ApplyProperties(props);
239 vector local_pos =
"0 0 0",
240 vector local_ori =
"0 0 0",
241 bool force_world_rotation =
false )
339 private proto
bool PlayParticleNative(
int flags);
346 override bool PlayParticleEx(
int particle_id = -1,
int flags = 0)
355 return PlayParticleNative(flags);
365 private proto
bool StopParticleNative(
int flags);
372 override bool StopParticle(
int flags = 0)
374 return StopParticleNative(flags);
381 private proto native
bool ResetParticleNative();
387 override bool ResetParticle()
389 return ResetParticleNative();
396 private proto native
bool RestartParticleNative();
402 override bool RestartParticle()
404 return RestartParticleNative();
411 private proto
bool IsParticlePlayingNative();
417 override bool IsParticlePlaying()
419 return IsParticlePlayingNative();
436 private proto native
bool SetParticleNative(
string path);
444 private bool SetParticle(
string path)
446 return SetParticleNative(
path);
454 bool SetParticleByID(
int id)
456 return SetParticle(
ParticleList.GetParticleFullPath(
id));
484 private proto
bool GetParticleNative(out
string path, EGetParticleMode mode);
492 bool GetParticle(out
string path, EGetParticleMode mode)
494 return GetParticleNative(
path, mode);
501 override int GetParticleID()
504 if (GetParticle(
path, EGetParticleMode.FILE))
516 int GetParticleIDLegacy()
519 if (GetParticle(
path, EGetParticleMode.NO_EXT))
540 private proto native
bool ApplyPropertiesNative(ParticleProperties properties);
547 bool ApplyProperties(ParticleProperties properties)
549 return ApplyPropertiesNative(properties);
566 override Object GetDirectParticleEffect()
575 override Object GetParticleParent()
577 return Object.Cast(GetParent());
584 private proto
bool HasActiveParticleNative();
590 override bool HasActiveParticle()
592 return HasActiveParticleNative();
600 private proto
int GetParticleCountNative();
607 override int GetParticleCount()
609 return GetParticleCountNative();
616 private proto
bool IsRepeatNative();
622 override bool IsRepeat()
624 return IsRepeatNative();
631 private proto
float GetMaxLifetimeNative();
637 override float GetMaxLifetime()
639 return GetMaxLifetimeNative();
646 proto native
Class GetOwner();
652 proto native
void SetOwner(
Class owner);
657 proto native
void Orphan();
678 proto native
int GetIndex();
694 proto
int GetCountID();
700 proto native
static int GetStaticCount();
706 proto native
static int GetStaticActiveCount();
726 super.OnParticleParented(parent);
738 if (!m_WiggleProcessing && IsWiggling())
740 float randomAngle = m_MaxOriWiggle;
741 float randomInterval = m_MaxOriInterval;
742 m_DefaultPos = m_DefaultWorldPos;
743 m_DefaultOri = m_DefaultWorldOri;
749 super.OnParticleUnParented(parent);
760 delete m_RandomizeOri;
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);
791 ApplyProperties(props);
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)
935 m_MaxOriWiggle = random_angle;
936 m_MaxOriInterval = random_interval;
948 m_DefaultOri = GetLocalYawPitchRoll();
949 m_DefaultWorldPos = GetWorldPosition();
950 m_DefaultWorldOri = GetYawPitchRoll();
951 m_ForceOrientationRelativeToWorld = IsHierarchyPositionOnly();
954 super.SetWiggle(random_angle, random_interval);
962 bool wiggling = IsWiggling();
969 int flags = ParticlePropertiesFlags.NONE;
971 if (m_ForceOrientationRelativeToWorld)
972 flags = ParticlePropertiesFlags.FORCE_WORLD_ROT;
974 ParticleProperties prop =
new ParticleProperties(m_DefaultPos, flags, GetParticleParent(), m_DefaultOri, GetOwner());
975 ApplyProperties(prop);
982 override private void RandomizeOrientation()
987 m_WiggleProcessing =
true;
989 if ( !m_RandomizeOri.IsRunning() )
990 m_RandomizeOri.Run(
Math.RandomFloat(0, m_MaxOriInterval) ,
this,
"RandomizeOrientation", null,
false);
992 int flags = ParticlePropertiesFlags.NONE;
994 if (m_ForceOrientationRelativeToWorld)
995 flags = ParticlePropertiesFlags.FORCE_WORLD_ROT;
997 ParticleProperties prop =
new ParticleProperties(m_DefaultPos, flags, GetParticleParent(), m_DefaultOri +
RandWiggleVector(), GetOwner());
998 ApplyProperties(prop);
1000 m_WiggleProcessing =
false;
1013 override private void UpdateState() {
ErrorEx(
"Should not be in use on ParticleSource."); }
1016 override private void DestroyParticleEffect() {
ErrorEx(
"Should not be in use on ParticleSource."); }
1019 override private void CreateParticleEffect() {
ErrorEx(
"Should not be in use on ParticleSource."); }
1025 override private void OnCheckAutoDelete() {
ErrorEx(
"Should not be in use on ParticleSource."); }
1028 override private void OnToDelete() {
ErrorEx(
"Should not be in use on ParticleSource."); }
Super root of all classes in Enforce script.
Legacy way of using particles in the game.
Object m_ParticleEffect
The child object which contains the actual particle.
vector RandWiggleVector()
Helper to get a randomized wiggle vector.
Object m_ParentObject
Parent Object the Particle is child of.
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.
override void ScaleParticleParamFromOriginal(int parameter_id, float coef)
Scales the given parameter on all emitors relatively to their ORIGINAL value.
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.
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.
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 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.
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.
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 int GetParticleAutoDestroyFlags()
Gets the currently set ParticleAutoDestroyFlags flags set on this ParticleSource.
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.
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.
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.
void DisableAutoDestroy()
Disables the particle automatically cleaning up itself when ending or stopping.
void OnParticleStop()
Event when the particle stops.
override void ScaleParticleParam(int parameter_id, float coef)
Scales the given parameter on all emitors relatively to their CURRENT value.
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 void SetParticleParam(int parameter_id, float value)
Set the value of a parameter of all emitors in the particle.
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
vector GetLocalPosition()
Get the local position of the Effect.
proto native CGame GetGame()
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)
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 ...