Table of Contents

Class ParticleSpawner

Namespace
Stride.Particles.Spawners
Assembly
Stride.Particles.dll

ParticleSpawner governs the rate at which new particles are emitted into the ParticleEmitter Multiple spawners with different triggering conditions can be part of the same ParticleEmitter

[DataContract("ParticleSpawner")]
public abstract class ParticleSpawner
Inheritance
ParticleSpawner
Derived

Properties

Delay

The minimum and maximum time the spawner should wait before starting to emit particles

[DataMember(10)]
[Display("Delay", null)]
public Vector2 Delay { get; set; }

Property Value

Vector2

Duration

The minimum and maximum duration the spawner will be active once it starts spawning particles

[DataMember(15)]
[Display("Duration", null)]
public Vector2 Duration { get; set; }

Property Value

Vector2

Enabled

Gets or sets a value indicating whether this ParticleSpawner is enabled.

[DataMember(-10)]
public bool Enabled { get; set; }

Property Value

bool

true if enabled; otherwise, false.

LoopCondition

Indicates if the spawner should loop, and if there is a delay every time it loops

[DataMember(5)]
[Display("Loop", null)]
public SpawnerLoopCondition LoopCondition { get; set; }

Property Value

SpawnerLoopCondition

Methods

GetMaxParticlesPerSecond()

Get the maximum number of particles this spawner can emit in one second

public abstract int GetMaxParticlesPerSecond()

Returns

int

Peak particles per second

GetUpdatedState(float, ParticleEmitter)

Updates and gets the current internal state

protected SpawnerState GetUpdatedState(float dt, ParticleEmitter emitter)

Parameters

dt float

Delta time in seconds since the last GetUpdatedState(float, ParticleEmitter) was called

emitter ParticleEmitter

Parent ParticleEmitter for this spawner

Returns

SpawnerState

InvalidateRelations()

Invalidates relation of this emitter to any other emitters that might be referenced

public virtual void InvalidateRelations()

MarkAsDirty()

Marking the spawner as dirty will notify the parent emitter that the maximum number of particles need to be recalculated

protected void MarkAsDirty()

NotifyStateSwitch(SpawnerState)

Will be called when the state changes. Override if you need to set/reset variables based on state changes

protected virtual void NotifyStateSwitch(SpawnerState newState)

Parameters

newState SpawnerState

The new state

SpawnNew(float, ParticleEmitter)

This method will be called form the emitter when it needs to poll how many particles to spawn (usually once per frame)

public abstract void SpawnNew(float dt, ParticleEmitter emitter)

Parameters

dt float

Time it has past since the last update (in seconds)

emitter ParticleEmitter

Parent emitter in which new particles should be emitter