Plush

EffectOccurrence#

PlushEngine · Type index

Namespace: PlushEngine

Runtime state of one playing effect: its particles per element, age and randomness, and where it emits from. An object's Effect emits from the object; one a script played (Scene.PlayEffect) emits from its own Position, which the script may MoveTo every step (a tracer on a bullet). The same seed replays the same particles: the stream mixes Seed with the object's ID, or with the play's order in the scene, never a process hash.

public sealed class EffectOccurrence

Members: Age · Direction · Effect · EmitAt · Entity · IsEmitting · IsFinished · MoveTo · ParticleCount · Position · Restart · Seed · Stop · Use

Age#

public float Age { get; }

Seconds since the effect (re)started.

Direction#

public Vector3 Direction { get; }

Effect#

public EffectAsset Effect { get; }

EmitAt#

public int EmitAt(Vector3 position, Vector3 direction, int count = 1, Vector3 inheritedVelocity = default);

Emits count particles per element from a world point into this occurrence's existing batches, using each element's authored look, lifetime, size and motion. Full element budgets refuse new particles; the return value is the total accepted. A played occurrence can be reused after it finishes. No new object or draw batch is created per point. Use a zero Rate and Burst for an explicitly driven emitter.

Entity#

public RuntimeEntity? Entity { get; }

The object whose Effect this is; null for an effect a script played.

IsEmitting#

public bool IsEmitting { get; }

IsFinished#

public bool IsFinished { get; }

Emission has ended (a non-looping effect's duration passed, or Stop) and the last particle died.

MoveTo#

public void MoveTo(Vector3 position, Vector3? direction = null);

Moves a played effect's emitter (attached elements, such as a tracer, ride along). Objects' effects follow their object instead.

ParticleCount#

public int ParticleCount { get; }

Position#

public Vector3 Position { get; }

Where it emits from (world), and along which direction: an object's position and up, or as played/moved.

Restart#

public void Restart(int? seed = null);

Starts over: particles cleared (allocations kept), bursts again, same seed unless one is given.

Seed#

public int Seed { get; }

Stop#

public void Stop(bool clear = false);

Stops emitting; the particles already out live out their lives (or vanish now with clear). A played effect is released once its last particle has died.

Use#

public EffectUse Use { get; }

EffectAsset · EffectUse · RuntimeEntity

Source#