public void CreateParticle(Texture2D texture, Rectangle sourceRect, ParticleInfo pInfo, EmitterType type)
        {
            if (sourceRect != Rectangle.Empty)
                this.Initialize(texture, sourceRect);
            else
                this.Initialize(texture);

            m_Type = type;

            m_CurrentLife = pInfo.m_Lifespan;
            m_Lifespan = pInfo.m_Lifespan;
            m_Position = pInfo.m_Pos;
            m_StartPos = pInfo.m_StartPos;
            m_Velocity = pInfo.m_Velocity;
            m_EmitterRadius = pInfo.m_EmitterRadius;
            m_EmitterRadiusDelta = pInfo.m_EmitterRadiusDelta;
            m_EmitterRotation = pInfo.m_EmitterRotation;
            m_EmitterRotationDelta = pInfo.m_EmitterRotationDelta;
            m_RadialAcceleration = pInfo.m_RadialAcceleration;
            m_TangentialAcceleration = pInfo.m_TangentialAcceleration;
            m_Scale = pInfo.m_Scale;
            m_ScaleDelta = pInfo.m_ScaleDelta;
            m_Color = pInfo.m_StartColor;
            m_StartColor = pInfo.m_StartColor;
            m_EndColor = pInfo.m_EndColor;
            m_ColorDelta = pInfo.m_ColorDelta;
            m_Rotation = pInfo.m_Rotation;
            m_RotationDelta = pInfo.m_RotationDelta;
            m_Depth = pInfo.m_Depth;
            m_DepthDelta = pInfo.m_DepthDelta;
            m_Speed = pInfo.m_Speed;
        }
 public void CreateParticle(Texture2D texture, ParticleInfo pInfo, EmitterType type)
 {
     CreateParticle(texture, Rectangle.Empty, pInfo, type);
 }
        /*  Function:  public abstract void createParticles()
         *   Purpose:  This function is abstract and will be defined by a derived class
         ****************************************************************/
        public virtual void CreateParticles()
        {
            Particle part = new Particle();
            ParticleInfo pInfo = new ParticleInfo();

            float angle = m_EmitterAngle + m_EmitterAngleVariance * rand(),
                  speed = m_Speed + m_SpeedVariance * rand(),
                  startSize = m_StartSize + m_StartSizeVariance * rand(),
                  endSize = m_EndSize + m_EndSizeVariance * rand();

            if (startSize < 0.1f)
                startSize = 0.1f;
            if (endSize < 0.1f)
                endSize = 0.1f;

            pInfo.m_Lifespan = m_Lifespan + m_LifespanVariance * rand();
            pInfo.m_Pos = new Vector2(m_Origin.X + m_XVariance * rand(), m_Origin.Y + m_YVariance * rand());
            pInfo.m_StartPos = new Vector2(m_Origin.X, m_Origin.Y);
            pInfo.m_Velocity = new Vector2(speed * (float)Math.Cos(angle), speed * (float)Math.Sin(angle));
            pInfo.m_EmitterRadius = m_MaxRadius + m_MaxRadiusVariance * rand();
            pInfo.m_EmitterRadiusDelta = (m_MaxRadius - m_MinRadius) / pInfo.m_Lifespan;
            pInfo.m_EmitterRotation = m_EmitterAngle + m_EmitterAngleVariance * rand();
            pInfo.m_EmitterRotationDelta = m_Degrees + m_DegreesVariance * rand();
            pInfo.m_RadialAcceleration = m_RadialAcceleration + m_RadialAccelerationVariance * rand();
            pInfo.m_TangentialAcceleration = m_TangentialAcceleration + m_TangentialAccelerationVariance * rand();
            pInfo.m_Scale = startSize / m_ParticleTexture.Width;
            pInfo.m_ScaleDelta = ((endSize - startSize) / pInfo.m_Lifespan) / m_ParticleTexture.Width;
            pInfo.m_Rotation = m_StartRotation + m_StartRotationVariance * rand();
            pInfo.m_RotationDelta = ((m_EndRotation + m_EndRotationVariance * rand()) - pInfo.m_Rotation) / pInfo.m_Lifespan;
            pInfo.m_Depth = 0f;
            pInfo.m_DepthDelta = (1f / pInfo.m_Lifespan);
            pInfo.m_Speed = m_Speed + m_SpeedVariance * rand();

            float sr = m_StartColor.R,
                  sg = m_StartColor.G,
                  sb = m_StartColor.B,
                  sa = m_StartColor.A,
                  fr = m_EndColor.R,
                  fg = m_EndColor.G,
                  fb = m_EndColor.B,
                  fa = m_EndColor.A;

            sr += m_StartColorVariance.R * rand();
            sg += m_StartColorVariance.G * rand();
            sb += m_StartColorVariance.B * rand();
            sa += m_StartColorVariance.A * rand();

            fr += m_EndColorVariance.R * rand();
            fg += m_EndColorVariance.G * rand();
            fb += m_EndColorVariance.B * rand();
            fa += m_EndColorVariance.A * rand();

            pInfo.m_StartColor = new fColor(sr, sg, sb, sa);

            pInfo.m_EndColor = new fColor(fr, fg, fb, fa);

            pInfo.m_ColorDelta = new fColor((fr - sr) / pInfo.m_Lifespan,
                                            (fg - sg) / pInfo.m_Lifespan,
                                            (fb - sb) / pInfo.m_Lifespan,
                                            (fa - sa) / pInfo.m_Lifespan);

            part.CreateParticle(m_ParticleTexture, m_SourceRectangle, pInfo, m_Type);

            m_Particles.Add(part);
        }