Class ParticleSystemSimulation
Namespace: ValveResourceFormat.Particles
Assembly: ValveResourceFormat.dll
Child systems: creation, group selection and group restarts.
public class ParticleSystemSimulationInheritance
object ← ParticleSystemSimulation
Constructors
ParticleSystemSimulation(ParticleSystem, IFileLoader, ILogger?, ParticleSnapshot?, ParticleSystemState?)
Builds a runnable system from its definition.
public ParticleSystemSimulation(ParticleSystem particleSystem, IFileLoader fileLoader, ILogger? logger = null, ParticleSnapshot? particleSnapshot = null, ParticleSystemState? parentSystemState = null)Parameters
particleSystem ParticleSystem
The system definition, read through its upgraded tree.
fileLoader IFileLoader
Resolves the child systems and snapshots the definition names.
logger ILogger?
Receives warnings about classes and fields that are not implemented. Pass nothing to run without any.
particleSnapshot ParticleSnapshot?
A snapshot to publish to the system, when it runs off one.
parentSystemState ParticleSystemState?
The state of the system running this one as a child.
Properties
BehaviorVersion
The behavior version the definition was authored against, which gates several engine behaviours.
public int BehaviorVersion { get; }Property Value
Children
The systems this one runs as children, in definition order.
public IReadOnlyList<ParticleSystemSimulation> Children { get; }Property Value
IReadOnlyList<ParticleSystemSimulation>
Definition
The upgraded definition this system was built from.
public KVObject Definition { get; }Property Value
KVObject
LocalBoundingBox
The box containing the system's particles, relative to its first control point.
public AABB LocalBoundingBox { get; }Property Value
MainControlPoint
Control point 0, which places the system in the world.
public ControlPoint MainControlPoint { get; set; }Property Value
Name
The file the system was loaded from, used in warnings.
public string Name { get; set; }Property Value
Observer
Watches this system so a drawing layer can follow it. Set by whatever draws the system, and null when nothing does.
public IParticleSystemObserver? Observer { get; set; }Property Value
Particles
This system's live particles.
public ParticleCollection Particles { get; }Property Value
RenderState
The state every function of this system reads it through.
public ParticleSystemState RenderState { get; }Property Value
Methods
BeginPrewarm(int)
Spawns throwaway particles so a drawing layer can prime buffers that need some to fill, and captures the emission state they disturb. Returns null when the system already holds particles.
public ParticleSystemSimulation.PrewarmScope? BeginPrewarm(int count)Parameters
count int
How many particles to spawn.
Returns
ParticleSystemSimulation.PrewarmScope?
EndPrewarm(PrewarmScope)
Drops the particles spawned and restores emission state.
public void EndPrewarm(ParticleSystemSimulation.PrewarmScope scope)Parameters
scope ParticleSystemSimulation.PrewarmScope
What returned.
FreezeChildren()
Holds every system below this one in place. freezes its own system directly and the rest of the tree through here.
public void FreezeChildren()GetControlPoint(int)
Gets one of the system's control points.
public ControlPoint GetControlPoint(int cp)Parameters
cp int
The control point index.
Returns
HasFinishedEmitting(bool, bool)
Whether the system has run out: nothing left to emit and, unless emissionEndIsEnough, no particle that survives another step.
the endcap.
public bool HasFinishedEmitting(bool emissionEndIsEnough, bool includeChildren)Parameters
emissionEndIsEnough bool
includeChildren bool
Returns
IsFinished()
Whether the system holds no particles, has nothing left to emit, and no child that does.
public bool IsFinished()Returns
PlayEndCap()
Starts the endcap on this system and everything below it, stamping each with its own age so a child's endcap timers run on the child's clock.
public void PlayEndCap()PlayEndCapOnly()
Plays the endcap by itself: the system is rewound, emission is stopped before a particle of its own can live, and anything a pre-simulated system spawned during the rewind is dropped. Only the endcap children are left to play.
public void PlayEndCapOnly()Replay()
Replays the system from scratch, discarding the particles still alive first. This is the viewer's restart affordance rather than engine behaviour: an effect whose pool is already saturated would otherwise have no free slots to emit into and appear to do nothing.
public void Replay()Restart()
Re-arms emission without destroying the particles already alive and without rewinding the system clock: survivors keep occupying pool slots and keep their real ages, so the next burst is limited to whatever m_nMaxParticles leaves free.
public void Restart()SetCameraPosition(Vector3)
Publishes the render camera position to this system and every child for camera-dependent particle inputs.
public void SetCameraPosition(Vector3 position)Parameters
position Vector3
SetDetailLevel(ParticleDetailLevel)
Sets the particle detail tier for this system; child systems inherit it.
public void SetDetailLevel(ParticleDetailLevel level)Parameters
level ParticleDetailLevel
ShouldRunAsChildOf(ParticleSystemState)
Whether the parent should advance this child this frame. An endcap child lies dormant until the parent starts its endcap, a delayed child waits out its delay on the parent's clock, and a child authored above the active detail tier never runs at all.
public bool ShouldRunAsChildOf(ParticleSystemState parentState)Parameters
parentState ParticleSystemState
The parent system's state.
Returns
Start()
Starts the system and its children, running any pre-simulation the definition asks for.
public void Start()Stop()
Stops emission on the system and its children, leaving live particles to finish.
public void Stop()Update(float, float)
Advances the system by one frame, in as many substeps as the definition's time step needs.
public void Update(float frameTime, float worldTime)Parameters
frameTime float
Seconds since the last update.
worldTime float
Seconds the containing world has been running.

