ParticleSystem Class
Definition
Namespace: Brine2D.Systems.Rendering
System that updates and renders particle emitters.
C#
public class ParticleSystem : Brine2D.ECS.IUpdateSystem, Brine2D.ECS.ISystem, Brine2D.ECS.IRenderSystem, System.IDisposable
Inheritance System.Object → ParticleSystem
Implements IUpdateSystem, ISystem, IRenderSystem, System.IDisposable
| Fields | |
|---|---|
| MaxWarmupDuration | Maximum allowed WarmupDuration that will be pre-simulated. Values above this are silently clamped so a misconfigured emitter cannot stall the first frame. |
| MinParticleLifetime | Minimum particle lifetime enforced after variation is applied, in seconds. Prevents negative or zero lifetimes from causing particles that expire instantly. |
| Properties | |
|---|---|
| TotalParticleCount | Total number of live particles across all active emitters and sub-emitters managed by this system. Useful for performance budgets and debug overlays. |
| Methods | |
|---|---|
| Burst\(Vector2, SubEmitterConfig\) | Fire-and-forget burst: spawns sub-particles at worldPosition using config without requiring an ECS entity or component. The burst is processed on the next Brine2D.Systems.Rendering.ParticleSystem.Update\(Brine2D\.ECS\.IEntityWorld,Brine2D\.Core\.GameTime\) call. |
| ClearAllSubEmitters() | Immediately expires all live sub-particles across every active sub-emitter and clears the internal sub-emitter list. Does not affect main emitter particles. |
| ClearSubEmitters\(SubEmitterConfig\) | Immediately expires all live sub-particles spawned from config and removes their states. Useful for cancelling death or birth sub-effects mid-flight. The config instance is matched by reference. |
| CountLiveSubParticles\(SubEmitterConfig\) | Returns the total number of live particles across all active SubEmitterState entries that share the given config instance \(by reference\). |
| LatticeNoise\(int, int\) | Returns a deterministic pseudo-random float in [0, 1] for the given integer lattice point. |
| LocalToWorldPos\(Vector2, TransformComponent\) | Converts a local-space particle position to world space, applying the entity's full transform \(translation, rotation, scale\). Used when computing world positions for sub-emitter spawn points on local-space emitters so that all three triggers — death, birth, and lifetime-fraction — correctly account for a rotated or scaled entity. |
| ValueNoise2D\(float, float\) | Bilinear value noise in [0, 1]. Smooth-stepped between integer lattice values for coherent, swirling turbulence rather than per-frame white noise. |