DPSF by Daniel Schroeder

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

.NET API 168,448 bytes

 ParticleSystemManager

public class ParticleSystemManager
Class to manage the Updating and Drawing of DPSF Particle Systems each frame
public bool Enabled { get; set; }

Get / Set if the Particle Systems should be Updated or not.

Returns a Linked List of handles to the Particle Systems in this Manager

Get if the Particle Systems are inheriting from DrawableGameComponent or not

public float SimulationSpeed { get; set; }

Get / Set how fast the Particle System Simulations should run.

Example: 1.0 = normal speed, 0.5 = half speed, 2.0 = double speed.

NOTE: This sets the SimulationSpeed property of each individual Particle System in this Manager to the given value. It will also set a particle system's Simulation Speed when the particle system is re-initialized, and when a new Particle System is added to the Manager in the future.

NOTE: Setting this property only has an effect if the SimulationSpeedIsEnabled property is true.

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

public bool SimulationSpeedIsEnabled { get; set; }

Get / Set if the Particle System Manager's SimulationSpeed property should be used for each of the particle systems it contains or not.

Default value is true.

public int TotalNumberOfActiveParticles { get; }

Get the cumulative Number Of Active Particles of all Particle Systems in this Manager

Get the cumulative Max Number Of Particles allocated in memory by all Particle Systems in the Manager.

Get the cumulative Number Of Particles Being Drawn by all Particle Systems in this Manager. This is the total number of Active AND Visible Particles.

NOTE: This ignores whether the Manager is Visible or not.

Gets the cumulative time (in milliseconds) it took to perform the Draw() function on each particle system in this manager.

Note: Only particle systems that have their PerformanceProfilingIsEnabled property set to true will be included in this total.

Gets the cumulative time (in milliseconds) it took to perform the Update() function on each particle system in this manager.

Note: Only particle systems that have their PerformanceProfilingIsEnabled property set to true will be included in this total.

public int UpdatesPerSecond { get; set; }

Get / Set how often the Particle Systems should be Updated.

NOTE: This sets the UpdatesPerSecond property of each individual Particle System in this Manager to the given value. It will also set a particle system's Updates Per Second when the particle system is re-initialized, and when a new Particle System is added to the Manager in the future.

NOTE: Setting this property only has an effect if the UpdatesPerSecondIsEnabled property is true.

NOTE: A value of zero means update the particle systems every time Update() is called.

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

public bool UpdatesPerSecondIsEnabled { get; set; }

Get / Set if the Particle System Manager's UpdatesPerSecond property should be used for each of the particle systems it contains or not.

Default value is true.

public bool Visible { get; set; }

Get / Set if this Particle Systems should be drawn or not.

NOTE: Setting this to false causes the particle systems' Draw() function to not be called, including the particle systems' BeforeDraw() and AfterDraw() functions.

Initializes a new instance of the ParticleSystemManager class.

Initializes a new instance of the ParticleSystemManager class, copying the settings of the given Particle System Manager.

public void AddParticleSystem(IDPSFParticleSystem cParticleSystemToAdd)

Add an initialized Particle System to the Particle System Manager.

NOTE: This sets the Particle System's ParticleSystemManagerToCopyPropertiesFrom property to this Particle System Manager.

public void AutoInitializeAllParticleSystems(GraphicsDevice cGraphicsDevice, ContentManager cContentManager, SpriteBatch cSpriteBatch)

Calls the AutoInitialize() function for every Particle System in this Manager

public bool ContainsParticleSystem(IDPSFParticleSystem cParticleSystemToFind)

Returns true if the given Particle System is in the Manager, false if not.

public bool ContainsParticleSystem(int iIDOfParticleSystemToFind)

Returns true if the Particle System with the given ID is in the Manager, false if not.

public void CopyFrom(ParticleSystemManager cManagerToCopy)

Copies the given DPSF Particle System Manager's information into this Manager.

Calls the Destroy() function for every Particle System in this Manager

Destroys each Particle System in the Manager, then removes them from the Manager

public void DrawAllParticleSystems()

Draws all of the Particle Systems.

NOTE: This will only Draw the Particle Systems if they do not inherit from DrawableGameComponent, since if they do they will be drawn automatically by the Game object.

public void DrawAllParticleSystemsAnimationToFiles(GraphicsDevice cGraphicsDevice, int iImageWidth, int iImageHeight, string sDirectoryName, float fTotalAnimationTime, float fTimeStep, bool bCreateAnimatedGIF, bool bCreateTileSetImage)

Draws the Particle Systems' Animation over the given timespan to a sequence of Image files.

NOTE: This function is not available on the Xbox 360.

Draws all of the Particle Systems, even if they inherit from DrawableGameComponent.

NOTE: If the Particle Systems inherit from DrawableGameComponent and this is called, the Particle Systems will be drawn twice each frame; once here and once when called automatically by the game object. If not inheriting from DrawableGameComponent, this function acts the same as calling DrawAllParticleSystems().

public Texture2D DrawAllParticleSystemsToTexture(GraphicsDevice cGraphicsDevice, int iTextureWidth, int iTextureHeight)

Draws all of the Particle Systems to a Texture and returns the Texture, which has a Transparent Black background

Removes all Particle Systems from the Particle System Manager

public bool RemoveParticleSystem(IDPSFParticleSystem cParticleSystemToRemove)

Removes the specified Particle System from the Particle System Manager. Returns true if the Particle System was found and removed, false if it was not found.

public bool RemoveParticleSystem(int iIDOfParticleSystemToRemove)

Removes the specified Particle System from the Particle System Manager. Returns true if the Particle System was found and removed, false if it was not found.

public void SetCameraPositionForAllParticleSystems(Vector3 cameraPosition)

Sets the CameraPosition property of all particle systems in this manager to the given Camera Position. This is done by calling the particle system's virtual SetCameraPosition() function.

public void SetEnabledAndVisibleStatesForAllParticleSystems(bool isEnabled, bool isVisible)

Sets the Enabled and Visible properties of all particle systems in this manager to the given states.

public void SetEnabledStateForAllParticleSystems(bool isEnabled)

Sets the Enabled property of all particle systems in this manager to the given state.

public void SetPerformanceProfilingIsEnabledForAllParticleSystems(bool performanceProfilingIsEnabled)

Sets the PerformanceProfilingIsEnabled property of all particle systems in this manager to the given value.

public void SetSimulationSpeedForAllParticleSystems(float fSimulationSpeed)

Sets each individual Particle Systems' Simulation Speed to the specified Simulation Speed.

public void SetTransformationMatrixForAllSpriteParticleSystems(Matrix sTransformationMatrix)

Sets the SpriteBatchSettings.TransformationMatrix for all Sprite Particle Systems in this Manager.

public void SetUpdatesPerSecondForAllParticleSystems(int iUpdatesPerSecond)

Sets each individual Particle Systems' Updates Per Second to the specified Updates Per Second.

public void SetVisibleStateForAllParticleSystems(bool isVisible)

Sets the Visible property of all particle systems in this manager to the given state.

public void SetWorldViewProjectionMatricesForAllParticleSystems(Matrix cWorld, Matrix cView, Matrix cProjection)

Sets the World, View, and Projection Matrices for all of the Particle Systems in this Manager.

NOTE: Sprite particle systems are not affected by the World, View, and Projection matrices.

public void UpdateAllParticleSystems(float fElapsedTimeInSeconds)

Updates all of the Particle Systems.

NOTE: This will only Update the Particle Systems if they do not inherit from DrawableGameComponent, since if they do they will be updated automatically by the Game object.

public void UpdateAllParticleSystemsForced(float fElapsedTimeInSeconds)

Updates all of the Particle Systems.

NOTE: If the Particle Systems inherit from DrawableGameComponent and this is called, the Particle Systems will be updated twice each frame; once here and once when called automatically by the game object. If not inheriting from DrawableGameComponent, this function acts the same as calling UpdateAllParticleSystems().