Stride

OPEN / CLOSE
  • Features
  • Blog
  • Documentation
  • Community
(icon) Download

  • Discord
  • Facebook
  • Twitter
  • YouTube

LANGUAGE

OPEN / CLOSE
  • English
  • 日本語
    Show / Hide Table of Contents

    ParticleSpawner Class

    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
    System.Object → ParticleSpawner
    Derived from ParticleSpawner: SpawnerBurst SpawnerFromDistance SpawnerFromParent SpawnerPerFrame SpawnerPerSecond

    [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)

    | Improve this Doc View Source

    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

    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
    Type Description
    SpawnerLoopCondition
    | Improve this Doc View Source

    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


    Extension Methods

    ComponentBaseExtensions.DisposeBy<T>(T, ICollectorHolder)
    ComponentBaseExtensions.RemoveDisposeBy<T>(T, ICollectorHolder)
    • Improve this Doc
    • View Source
    In This Article

    Back to top

    Copyright © 2019-2021 .NET Foundation and Contributors
    Supported by the .NET Foundation