DPSF by Daniel Schroeder

<PackageReference Include="DPSF" Version="2.5.0" />

.NET API 168,448 bytes

 ParticleEmitter

public class ParticleEmitter
Class used to automatically create new Particles in a Particle System.
public int BurstParticles { get; set; }

Get / Set how many Particles the Emitter should Burst. The Emitter will emit Particles, at the speed corresponding to its Particles Per Second rate, until this amount of Particles have been emitted.

NOTE: Bursts are only processed when the Emit Particles Automatically property is false.

NOTE: Bursts will only emit Particles if the Emitter is Enabled.

NOTE: This will be set to zero if a negative value is specified.

NOTE: This will fire the BurstComplete event when it reaches (or is set to) zero.

public float BurstTime { get; set; }

Get / Set how long the Emitter should Burst for (in seconds). The Emitter will emit Particles, at the speed corresponding to its Particles Per Second rate, until this amount of time in seconds has elapsed.

NOTE: Bursts are only processed when the Emit Particles Automatically property is false.

NOTE: Bursts will only emit Particles if the Emitter is Enabled.

NOTE: This will be set to zero if a negative value is specified.

NOTE: This will fire the BurstComplete event when it reaches (or is set to) zero.

public bool EmitParticlesAutomatically { get; set; }

Get / Set if the Emitter should Emit Particles Automatically or not.

NOTE: Particles will only be emitted if the Emitter is Enabled.

public bool Enabled { get; set; }

Get / Set if the Emitter is able to Emit Particles or not.

NOTE: If this is false, not even Bursts will Emit Particles.

NOTE: The Position, Orientation, and Pivot Data will still be updated when this is false.

public int ID { get; }

Get the unique ID of this Emitter.

public bool LerpEmittersPositionAndOrientation { get; set; }

This property tells if the we should Lerp (Linearly Interpolate) the Position and Orientation of the Emitter from one update to the next. If the Emitter is moving very fast, this allows the particle system to spawn new particles in between the Emitter's old and new position, so that new particles are evenly spaced out between the Emitter's previous and current position, instead of all of the particles being spawned at the Emitter's new position.

If this property is true, the Emitter's Position and Orientation will be Lerped while emitting particles.

If this property is false, all of the particles will be emitted as the Emitter's current Position and Orientation.

If you generally want Lerping enabled, but want to temporarily disable it to "teleport" the emitter from one position to another without particles being Lerped between the two positions, you can set this properly to false and then back to true after the particle system's Update() function has been called, or you can simply set the LerpEmittersPositionAndOrientationOnNextUpdate to false, which will disable Lerping the position and orientation only for the next particle system Update().

Default is true.

If this is true the Emitter's Position and Orientation will not be Lerped during the particle system's next Update() function call. The Update() function will always set this value back to false after all of the particle's have been emitted for that Update() call.

Setting this to true allows you to "teleport" the Emitter from one position to another without particles being released at any positions in between the Emitter's old and new Position and Orientation.

public int NumberOfParticlesEmitted { get; set; }

How many particles this emitter has added to the particle system.

NOTE: This value is not automatically updated by the emitter itself; it needs to be increased manually. This is because even though the emitter may say that it wants to emit 100 particles, the particle system may only have room for 50 particles, so we would only want this value increased by 50, not 100.

NOTE: DPSF Particle System handle updating this value automatically for you, but if you are using an emitter outside of the particle system's Emitters collection and are just manually calling the AddParticles() function yourself, then you will need to manually increase this value with whatever number is returned by the AddParticles() function.

NOTE: The max value of an int is 2,147,483,647 so if this reaches that value it will wrap around to -2,147,483,648.

Get the Orientation Data (Orientation, Rotational Velocity, and Rotational Acceleration)

public float ParticlesPerSecond { get; set; }

Get / Set how many Particles should be emitted per Second

public PivotPoint3D PivotPointData { get; }

Get the Pivot Point Data (Pivot Point, Pivot Rotational Velocity, and Pivot Rotational Acceleration)

public Position3D PositionData { get; }

Get the Position Data (Position, Velocity, and Acceleration)

Raised when a Burst property reaches (or is set to) zero.

public ParticleEmitter()

Initializes a new instance of the ParticleEmitter class.

public ParticleEmitter(ParticleEmitter emitterToCopy)

Initializes a new instance of the ParticleEmitter class.

public void CopyFrom(ParticleEmitter emitterToCopy)

Copies the given Emitter's values into this instance.

public int UpdateAndGetNumberOfParticlesToEmit(float fElapsedTimeInSeconds)

Updates the Emitter's Position and Orientation according to its Velocities and Accelerations, and returns how many Particles should be emitted this frame.