/// <summary>
 /// Allows the game component to perform any initialization it needs to before starting
 /// to run.  This is where it can query for any required services and load content.
 /// </summary>
 public override void Initialize()
 {
     // TODO: Add your initialization code here
     m_emitters = new SwampLib.Pool <ParticleEmitter>(1000);
     m_textures = new Dictionary <string, Texture2D>();
     base.Initialize();
 }
 /// <summary>
 /// AddParticles's job is to add an effect somewhere on the screen. If there
 /// aren't enough particles in the freeParticles queue, it will use as many as
 /// it can. This means that if there not enough particles available, calling
 /// AddParticles will have no effect.
 /// </summary>
 /// <param name="where">where the particle effect should be created</param>
 public void AddParticles(Vector2 where, int numParticles)
 {
     // Create the desired number of particles, up to the number of available
     // particles in the pool.
     numParticles = Math.Min(numParticles, particles.AvailableCount);
     while (numParticles-- > 0)
     {
         SwampLib.Pool <Particle> .Node p = particles.Get();
         InitializeParticle(p.Item, where);
     }
 }
        /// <summary>
        /// override the base class's Initialize to do some additional work; we want to
        /// call InitializeConstants to let subclasses set the constants that we'll use.
        ///
        /// also, the particle array and freeParticles queue are set up here.
        /// </summary>
        public void Initialize(string texture, int howManyEffects)
        {
            Texture2D tex = StarTrooperGame.ParticleManager.LoadTexture(texture);

            m_texture        = texture;
            m_howManyEffects = howManyEffects;
            // Calculate the center. this'll be used in the draw call, we
            // always want to rotate and scale around this point.
            m_origin.X = tex.Width / 2;
            m_origin.Y = tex.Height / 2;

            InitializeConstants();

            // Create a pool contiaining the maximum number of particles we will ever need for this effect.
            particles = new SwampLib.Pool <Particle>(m_howManyEffects * maxNumParticles);

            m_active = true;
        }