Time for action – the ParticleManager class
To manage the particles in our game, we will create the PraticleManager
class by performing the following steps:
1. Add a new class called
ParticleManager.cs
to the Tank Battles project.2. Add the following declarations at the beginning of the
ParticleManager
class file:using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics;
3. Modify the declaration of the
ParticleManager
class to make it a static class. The declaration should now read as follows:static class ParticleManager
4. Add fields to the
ParticleManager
class as follows:#region Fields private static GraphicsDevice graphicsDevice; private static List<Particle> particles = new List<Particle>(); private static Effect particleEffect; private static Texture2D particleTexture; private static Random rand = new Random(); #endregion
5. Add the
Initialize()
method to theParticleManager
class as follows:#region Initialization public static void Initialize( GraphicsDevice...