ParticleSpawner Class
Namespace: Stride.Particles.SpawnersAssembly: Stride.Particles.dll
[DataContract("ParticleSpawner")]
public abstract class ParticleSpawner
| Name | Description | |
|---|---|---|
| Properties | ||
| Delay | The minimum and maximum time the spawner should wait before starting to emit particles |
|
| Duration | The minimum and maximum duration the spawner will be active once it starts spawning particles |
|
| Enabled | Gets or sets a value indicating whether this ParticleSpawner is enabled. |
|
| LoopCondition | Indicates if the spawner should loop, and if there is a delay every time it loops |
|
| Methods | ||
| GetMaxParticlesPerSecond() | Get the maximum number of particles this spawner can emit in one second |
|
| GetUpdatedState(Single, ParticleEmitter) | Updates and gets the current internal state |
|
| InvalidateRelations() | Invalidates relation of this emitter to any other emitters that might be referenced |
|
| MarkAsDirty() | Marking the spawner as dirty will notify the parent emitter that the maximum number of particles need to be recalculated |
|
| NotifyStateSwitch(SpawnerState) | Will be called when the state changes. Override if you need to set/reset variables based on state changes |
|
| SpawnNew(Single, ParticleEmitter) | This method will be called form the emitter when it needs to poll how many particles to spawn (usually once per frame) |
|
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
| Type | Description |
|---|---|
| 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
| Type | Description |
|---|---|
| Vector2 |
Enabled
Gets or sets a value indicating whether this ParticleSpawner is enabled.
[DataMember(-10)]
public bool Enabled { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
|
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
| Type | Description |
|---|---|
| SpawnerLoopCondition |
Methods
GetMaxParticlesPerSecond()
Get the maximum number of particles this spawner can emit in one second
public abstract int GetMaxParticlesPerSecond()
Returns
| Type | Description |
|---|---|
| System.Int32 | Peak particles per second |
GetUpdatedState(Single, ParticleEmitter)
Updates and gets the current internal state
protected SpawnerState GetUpdatedState(float dt, ParticleEmitter emitter)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Single | dt | Delta time in seconds since the last GetUpdatedState(Single, ParticleEmitter) was called |
| ParticleEmitter | emitter | Parent ParticleEmitter for this spawner |
Returns
| Type | Description |
|---|---|
| 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
| Type | Name | Description |
|---|---|---|
| SpawnerState | newState | The new state |
SpawnNew(Single, 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
| Type | Name | Description |
|---|---|---|
| System.Single | dt | Time it has past since the last update (in seconds) |
| ParticleEmitter | emitter | Parent emitter in which new particles should be emitter |