示例#1
0
        protected void UpdateParticleTransparencyWithQuickFadeOut(DPSFDefaultBaseParticle cParticle, float fElapsedTimeInSeconds)
        {
            // Calculate how transparent the Particle should be and apply it
            byte bAlpha = DPSFHelper.FadeOutQuicklyBasedOnLifetime(cParticle.NormalizedElapsedTime);

            cParticle.Color = new Color(cParticle.Color.R, cParticle.Color.G, cParticle.Color.B, bAlpha);
        }
示例#2
0
        /// <summary>
        /// Applies the Particle's Friction to the its Velocity to slow the Particle down to a stop
        /// </summary>
        /// <param name="cParticle">The Particle to update</param>
        /// <param name="fElapsedTimeInSeconds">How long it has been since the last update</param>
        protected void UpdateParticleVelocityUsingFriction(DPSFDefaultBaseParticle cParticle, float fElapsedTimeInSeconds)
        {
            // If the Particle is still moving and there is Friction to apply
            if (cParticle.Velocity != Vector3.Zero && cParticle.Friction != 0.0f)
            {
                // Copy the Particle's Velocity
                Vector3 sNewVelocity = cParticle.Velocity;

                // Get the current Speed of the Particle and calculate what its new Speed should be
                float fSpeed = sNewVelocity.Length();
                fSpeed -= (cParticle.Friction * fElapsedTimeInSeconds);

                // If the Particle has slowed to a stop
                if (fSpeed <= 0.0f)
                {
                    // Stop it from moving
                    sNewVelocity = Vector3.Zero;
                }
                // Else the Particle should still be moving
                else
                {
                    // Calculate the Particle's new Velocity vector at the new Speed
                    sNewVelocity.Normalize();
                    sNewVelocity *= fSpeed;
                }

                // Make the Particle travel at the new Velocity
                cParticle.Velocity = sNewVelocity;
            }
        }
示例#3
0
        /// <summary>
        /// Linearly interpolates the Particle's Transparency to fade in based on the Particle's Normalized Elapsed Time.
        /// <para>If you are also updating the Particle Color using an EveryTime Event, be sure to set the ExecutionOrder of the
        /// event calling this function to be greater than that one, so that this function is called AFTER the color update function.</para>
        /// </summary>
        /// <param name="cParticle">The Particle to update</param>
        /// <param name="fElapsedTimeInSeconds">How long it has been since the last update</param>
        protected void UpdateParticleTransparencyToFadeInUsingLerp(DPSFDefaultBaseParticle cParticle, float fElapsedTimeInSeconds)
        {
            // Calculate how transparent the Particle should be and apply it
            byte bAlpha = (byte)(cParticle.NormalizedElapsedTime * 255);

            cParticle.Color = new Color(cParticle.Color.R, cParticle.Color.G, cParticle.Color.B, bAlpha);
        }
示例#4
0
        /// <summary>
        /// Calculates how much affect each of the Particle System's Magnets should have on
        /// this Particle and updates the Particle's Velocity accordingly.
        /// </summary>
        /// <param name="cParticle">The Particle to update</param>
        /// <param name="fElapsedTimeInSeconds">How long it has been since the last update</param>
        protected void UpdateParticleVelocityAccordingToMagnets(DPSFDefaultBaseParticle cParticle, float fElapsedTimeInSeconds)
        {
            // Loop through each of the Particle System's Magnets
            for (int index = 0; index < MagnetList.Count; index++)
            {
                DefaultParticleSystemMagnet magnet = MagnetList[index];

                // If this is not a custom user Magnet (i.e. it is Attracting or Repelling)
                if (magnet.Mode != DefaultParticleSystemMagnet.MagnetModes.Other)
                {
                    // Apply the Force to the Particle's Position
                    cParticle.Velocity += (CalculateForceMagnetShouldExertOnParticle(magnet, cParticle) * fElapsedTimeInSeconds);
                }
            }
        }
示例#5
0
        /// <summary>
        /// Deep copy all of the Particle properties
        /// </summary>
        /// <param name="ParticleToCopy">The Particle to Copy the properties from</param>
        public override void CopyFrom(DPSFParticle ParticleToCopy)
        {
            // Cast the Particle to the type it really is
            DPSFDefaultBaseParticle cParticleToCopy = (DPSFDefaultBaseParticle)ParticleToCopy;

            base.CopyFrom(cParticleToCopy);
            this.Position = cParticleToCopy.Position;
            this.Color    = cParticleToCopy.Color;

            this.Velocity      = cParticleToCopy.Velocity;
            this.Acceleration  = cParticleToCopy.Acceleration;
            this.ExternalForce = cParticleToCopy.ExternalForce;
            this.Friction      = cParticleToCopy.Friction;
            this.StartColor    = cParticleToCopy.StartColor;
            this.EndColor      = cParticleToCopy.EndColor;
        }
示例#6
0
        //===========================================================
        // Particle System Update Functions
        //===========================================================

        /// <summary>
        /// Sorts the Particle System's Active Particles so that the Particles at the back
        /// (i.e. Position.Z = 1.0) are drawn before the Particles at the front (i.e.
        /// Position.Z = 0.0).
        /// <para>NOTE: This operation is very expensive and should only be used when you are
        /// using a Shader (i.e. Effect and Technique).</para>
        /// <para>If you are not using a Shader and want the Particles sorted by Depth, use SpriteSortMode.BackToFront.</para>
        /// <para>Merge Sort is the sorting algorithm used, as it tends to be best for linked lists.
        /// TODO - WHILE MERGE SORT SHOULD BE USED, DUE TO TIME CONSTRAINTS A (PROBABLY) SLOWER METHOD (QUICK-SORT)
        /// IS BEING USED INSTEAD. THIS FUNCTION NEEDS TO BE UPDATED TO USE MERGE SORT STILL.
        /// THE LINKED LIST MERGE SORT ALGORITHM CAN BE FOUND AT http://www.chiark.greenend.org.uk/~sgtatham/algorithms/listsort.html</para>
        /// </summary>
        /// <param name="fElapsedTimeInSeconds">How long it has been since the last update</param>
        protected void UpdateParticleSystemToSortParticlesByDepth(float fElapsedTimeInSeconds)
        {
            // Store the Number of Active Particles to sort
            int iNumberOfActiveParticles = ActiveParticles.Count;

            // If there is nothing to sort
            if (iNumberOfActiveParticles <= 1)
            {
                // Exit without sorting
                return;
            }

            // Create a List to put the Active Particles in to be sorted
            List <Particle> cActiveParticleList = new List <Particle>(iNumberOfActiveParticles);

            // Add all of the Particles to the List
            LinkedListNode <Particle> cNode = ActiveParticles.First;

            while (cNode != null)
            {
                // Copy this Particle into the Array
                cActiveParticleList.Add(cNode.Value);

                // Move to the next Active Particle
                cNode = cNode.Next;
            }

            // Now that the List is full, sort it
            cActiveParticleList.Sort(delegate(Particle Particle1, Particle Particle2)
            {
                DPSFDefaultBaseParticle cParticle1 = (DPSFDefaultBaseParticle)(DPSFParticle)Particle1;
                DPSFDefaultBaseParticle cParticle2 = (DPSFDefaultBaseParticle)(DPSFParticle)Particle2;
                return(cParticle1.Position.Z.CompareTo(cParticle2.Position.Z));
            });

            // Now that the List is sorted, add the Particles into the Active Particles Linked List in sorted order
            ActiveParticles.Clear();
            for (int iIndex = 0; iIndex < iNumberOfActiveParticles; iIndex++)
            {
                // Add this Particle to the Active Particles Linked List.
                // List is sorted from smallest to largest, but we want
                // our Linked List sorted from largest to smallest, since
                // the Particles at the end of the Linked List are drawn last.
                ActiveParticles.AddFirst(cActiveParticleList[iIndex]);
            }
        }
示例#7
0
        /// <summary>
        /// Calculates how much affect each of the Particle System's Magnets should have on
        /// this Particle and updates the Particle's Velocity accordingly.
        /// </summary>
        /// <param name="cParticle">The Particle to update</param>
        /// <param name="fElapsedTimeInSeconds">How long it has been since the last update</param>
        protected void UpdateParticleVelocityAccordingToMagnets(DPSFDefaultBaseParticle cParticle, float fElapsedTimeInSeconds)
        {
            // Temp handle to a Magnet
            DefaultParticleSystemMagnet cMagnet = null;

            // Loop through each of the Particle System's Magnets
            LinkedListNode <DefaultParticleSystemMagnet> cNode = MagnetList.First;

            while (cNode != null)
            {
                // Get a handle to this Magnet
                cMagnet = (DefaultParticleSystemMagnet)cNode.Value;

                // If this is not a custom user Magnet (i.e. it is Attracting or Repelling)
                if (cMagnet.Mode != DefaultParticleSystemMagnet.MagnetModes.Other)
                {
                    // Apply the Force to the Particle's Position
                    cParticle.Velocity += (CalculateForceMagnetShouldExertOnParticle(cMagnet, cParticle) * fElapsedTimeInSeconds);
                }

                // Move to the next Magnet in the list
                cNode = cNode.Next;
            }
        }
示例#8
0
        /// <summary>
        /// Returns the vector force that a Magnet should exert on a Particle
        /// </summary>
        /// <param name="cMagnet">The Magnet affecting the Particle</param>
        /// <param name="cParticle">The Particle being affected by the Magnet</param>
        /// <returns>Returns the vector force that a Magnet should exert on a Particle</returns>
        protected Vector3 CalculateForceMagnetShouldExertOnParticle(DefaultParticleSystemMagnet cMagnet, DPSFDefaultBaseParticle cParticle)
        {
            // Variable to store the Force to Exert on the Particle
            Vector3 sForceToExertOnParticle = Vector3.Zero;

            // Calculate which Direction to push the Particle
            Vector3 sDirectionToPushParticle;

            // If this is a Point Magnet
            if (cMagnet.MagnetType == DefaultParticleSystemMagnet.MagnetTypes.PointMagnet)
            {
                // Cast the Magnet to the proper type
                MagnetPoint cPointMagnet = (MagnetPoint)cMagnet;

                // Calculate the direction to attract the Particle to the point in space where the Magnet is
                sDirectionToPushParticle = cPointMagnet.PositionData.Position - cParticle.Position;
            }
            // Else If this is a Line Magnet
            else if (cMagnet.MagnetType == DefaultParticleSystemMagnet.MagnetTypes.LineMagnet)
            {
                // Cast the Magnet to the proper type
                MagnetLine cLineMagnet = (MagnetLine)cMagnet;

                // Calculate the closest point on the Line to the Particle.
                // Equation taken from http://ozviz.wasp.uwa.edu.au/~pbourke/geometry/pointline/
                // Also explained at http://www.allegro.cc/forums/thread/589720

                // Calculate 2 points on the Line
                Vector3 sPosition1 = cLineMagnet.PositionOnLine;
                Vector3 sPosition2 = cLineMagnet.PositionOnLine + cLineMagnet.Direction;

                // Put calculations into temp variables for speed and easy readability
                float fA = cParticle.Position.X - sPosition1.X;
                float fB = cParticle.Position.Y - sPosition1.Y;
                float fC = cParticle.Position.Z - sPosition1.Z;
                float fD = sPosition2.X - sPosition1.X;
                float fE = sPosition2.Y - sPosition1.Y;
                float fF = sPosition2.Z - sPosition1.Z;

                // Next calculate the value of U.
                // NOTE: The Direction is normalized, so the distance between Position1 and Position2 is one, so we
                // don't need to bother squaring and dividing by the length here.
                float fU = (fA * fD) + (fB * fE) + (fC * fF);

                // Calculate the closest point on the Line to the Particle
                Vector3 sClosestPointOnLine = new Vector3();
                sClosestPointOnLine.X = sPosition1.X + (fU * fD);
                sClosestPointOnLine.Y = sPosition1.Y + (fU * fE);
                sClosestPointOnLine.Z = sPosition1.Z + (fU * fF);

                // Calculate the direction to attract the Particle to the closest point on the Line
                sDirectionToPushParticle = sClosestPointOnLine - cParticle.Position;
            }
            // Else if the is a Line Segment Magnet
            else if (cMagnet.MagnetType == DefaultParticleSystemMagnet.MagnetTypes.LineSegmentMagnet)
            {
                // Cast the Magnet to the proper type
                MagnetLineSegment cLineSegmentMagnet = (MagnetLineSegment)cMagnet;

                // Calculate the closest point on the Line to the Particle.
                // Equation taken from http://ozviz.wasp.uwa.edu.au/~pbourke/geometry/pointline/
                // Also explained at http://www.allegro.cc/forums/thread/589720

                // Calculate 2 points on the Line
                Vector3 sPosition1 = cLineSegmentMagnet.EndPoint1;
                Vector3 sPosition2 = cLineSegmentMagnet.EndPoint2;

                // Put calculations into temp variables for speed and easy readability
                float fA = cParticle.Position.X - sPosition1.X;
                float fB = cParticle.Position.Y - sPosition1.Y;
                float fC = cParticle.Position.Z - sPosition1.Z;
                float fD = sPosition2.X - sPosition1.X;
                float fE = sPosition2.Y - sPosition1.Y;
                float fF = sPosition2.Z - sPosition1.Z;

                // Next calculate the value of U
                float fDot           = (fA * fD) + (fB * fE) + (fC * fF);
                float fLengthSquared = (fD * fD) + (fE * fE) + (fF * fF);
                float fU             = fDot / fLengthSquared;

                // Calculate the closest point on the Line to the Particle
                Vector3 sClosestPointOnLine = new Vector3();

                // If the Particle is closest to the first End Point
                if (fU < 0.0f)
                {
                    sClosestPointOnLine = sPosition1;
                }
                // Else If the Particle is closest to the second End Point
                else if (fU > 1.0f)
                {
                    sClosestPointOnLine = sPosition2;
                }
                // Else the Particle is closest to the Line Segment somewhere between the End Points
                else
                {
                    // Calculate where in between the End Points the Particle is closest to
                    sClosestPointOnLine.X = sPosition1.X + (fU * (sPosition2.X - sPosition1.X));
                    sClosestPointOnLine.Y = sPosition1.Y + (fU * (sPosition2.Y - sPosition1.Y));
                    sClosestPointOnLine.Z = sPosition1.Z + (fU * (sPosition2.Z - sPosition1.Z));
                }

                // Calculate the direction to attract the Particle to the closest point on the Line
                sDirectionToPushParticle = sClosestPointOnLine - cParticle.Position;
            }
            // Else If this is a Plane Magnet
            else if (cMagnet.MagnetType == DefaultParticleSystemMagnet.MagnetTypes.PlaneMagnet)
            {
                // Cast the Magnet to the proper type
                MagnetPlane cPlaneMagnet = (MagnetPlane)cMagnet;

                // Calculate the closest point on the Plane to the Particle.
                // Equation taken from http://ozviz.wasp.uwa.edu.au/~pbourke/geometry/pointline/

                // Calculate how far from the Plane the Particle is
                float fDistanceFromPlane = Vector3.Dot(cParticle.Position - cPlaneMagnet.PositionOnPlane, cPlaneMagnet.Normal);

                // Calculate the closest point on the Plane to the Particle
                Vector3 sClosestPointOnPlane = cParticle.Position + (-cPlaneMagnet.Normal * fDistanceFromPlane);

                // Calculate the direction to attract the Particle to the closest point on the Plane
                sDirectionToPushParticle = sClosestPointOnPlane - cParticle.Position;
            }
            // Else we don't know what kind of Magnet this is
            else
            {
                // So exit returning no force
                return(Vector3.Zero);
            }

            // If the Particle should be Repelled away from the Magnet (instead of attracted to it)
            if (cMagnet.Mode == DefaultParticleSystemMagnet.MagnetModes.Repel)
            {
                // Reverse the direction we are going to push the Particle
                sDirectionToPushParticle *= -1;
            }

            // If the Direction To Push the Particle is not valid and we should be Repelling the Particle
            if (sDirectionToPushParticle == Vector3.Zero && cMagnet.Mode == DefaultParticleSystemMagnet.MagnetModes.Repel)
            {
                // Pick a random Direction vector with a very short length to repel the Particle with
                sDirectionToPushParticle = DPSFHelper.RandomNormalizedVector() * 0.00001f;
            }

            // Get how far away the Particle is from the Magnet
            float fDistanceFromMagnet = sDirectionToPushParticle.Length();

            // If the Particle is within range to be affected by the Magnet
            if (fDistanceFromMagnet >= cMagnet.MinDistance && fDistanceFromMagnet <= cMagnet.MaxDistance)
            {
                // If the Direction To Push the Particle is valid
                if (sDirectionToPushParticle != Vector3.Zero)
                {
                    // Normalize the Direction To Push the Particle
                    sDirectionToPushParticle.Normalize();
                }

                // Calculate the normalized distance from the Magnet that the Particle is
                float fLerpAmount = 0.0f;
                if (cMagnet.MaxDistance != cMagnet.MinDistance)
                {
                    fLerpAmount = (fDistanceFromMagnet - cMagnet.MinDistance) / (cMagnet.MaxDistance - cMagnet.MinDistance);
                }
                // Else the Max Distance equals the Min Distance
                else
                {
                    // So to avoid a divide by zero we just assume a full Lerp amount
                    fLerpAmount = 1.0f;
                }

                // Calculate how much of the Max Force to apply to the Particle
                float fNormalizedForce = 0.0f;
                switch (cMagnet.DistanceFunction)
                {
                default:
                case DefaultParticleSystemMagnet.DistanceFunctions.Constant:
                    fNormalizedForce = cMagnet.MaxForce;
                    break;

                case DefaultParticleSystemMagnet.DistanceFunctions.Linear:
                    fNormalizedForce = MathHelper.Lerp(0, cMagnet.MaxForce, fLerpAmount);
                    break;

                case DefaultParticleSystemMagnet.DistanceFunctions.Squared:
                    fNormalizedForce = MathHelper.Lerp(0, cMagnet.MaxForce, fLerpAmount * fLerpAmount);
                    break;

                case DefaultParticleSystemMagnet.DistanceFunctions.Cubed:
                    fNormalizedForce = MathHelper.Lerp(0, cMagnet.MaxForce, fLerpAmount * fLerpAmount * fLerpAmount);
                    break;

                case DefaultParticleSystemMagnet.DistanceFunctions.LinearInverse:
                    fNormalizedForce = MathHelper.Lerp(cMagnet.MaxForce, 0, fLerpAmount);
                    break;

                case DefaultParticleSystemMagnet.DistanceFunctions.SquaredInverse:
                    fNormalizedForce = MathHelper.Lerp(cMagnet.MaxForce, 0, fLerpAmount * fLerpAmount);
                    break;

                case DefaultParticleSystemMagnet.DistanceFunctions.CubedInverse:
                    fNormalizedForce = MathHelper.Lerp(cMagnet.MaxForce, 0, fLerpAmount * fLerpAmount * fLerpAmount);
                    break;
                }

                // Calculate how much Force should be Exerted on the Particle
                sForceToExertOnParticle = sDirectionToPushParticle * (fNormalizedForce * cMagnet.MaxForce);
            }

            // Return how much Force to Exert on the Particle
            return(sForceToExertOnParticle);
        }
示例#9
0
 /// <summary>
 /// Linearly interpolates the Particle's Color between it's Start Color and End Color based on the Particle's Normalized Elapsed Time.
 /// </summary>
 /// <param name="cParticle">The Particle to update</param>
 /// <param name="fElapsedTimeInSeconds">How long it has been since the last update</param>
 protected void UpdateParticleColorUsingLerp(DPSFDefaultBaseParticle cParticle, float fElapsedTimeInSeconds)
 {
     // Update the Particle's Color
     cParticle.Color = DPSFHelper.LerpColor(cParticle.StartColor, cParticle.EndColor, cParticle.NormalizedElapsedTime);
 }
示例#10
0
 /// <summary>
 /// Applies the External Force to the Particle's Velocity
 /// </summary>
 /// <param name="cParticle">The Particle to update</param>
 /// <param name="fElapsedTimeInSeconds">How long it has been since the last update</param>
 protected void UpdateParticleVelocityUsingExternalForce(DPSFDefaultBaseParticle cParticle, float fElapsedTimeInSeconds)
 {
     // Apply the External Force to the Particle's Velocity
     cParticle.Velocity += (cParticle.ExternalForce * fElapsedTimeInSeconds);
 }
示例#11
0
 /// <summary>
 /// Applies the External Force to the Particle's Position
 /// </summary>
 /// <param name="cParticle">The Particle to update</param>
 /// <param name="fElapsedTimeInSeconds">How long it has been since the last update</param>
 protected void UpdateParticlePositionUsingExternalForce(DPSFDefaultBaseParticle cParticle, float fElapsedTimeInSeconds)
 {
     // Apply the External Force to the Particle's Position
     cParticle.Position += (cParticle.ExternalForce * fElapsedTimeInSeconds);
 }
示例#12
0
 /// <summary>
 /// Updates a Particle's Velocity according to its Acceleration, and then the Position according to the new Velocity
 /// </summary>
 /// <param name="cParticle">The Particle to update</param>
 /// <param name="fElapsedTimeInSeconds">How long it has been since the last update</param>
 protected void UpdateParticlePositionAndVelocityUsingAcceleration(DPSFDefaultBaseParticle cParticle, float fElapsedTimeInSeconds)
 {
     // Update the Particle Velocity and Position according to Acceleration
     cParticle.Velocity += cParticle.Acceleration * fElapsedTimeInSeconds;
     cParticle.Position += cParticle.Velocity * fElapsedTimeInSeconds;
 }
示例#13
0
 /// <summary>
 /// Update a Particle's Velocity according to its Acceleration
 /// </summary>
 /// <param name="cParticle">The Particle to update</param>
 /// <param name="fElapsedTimeInSeconds">How long it has been since the last update</param>
 protected void UpdateParticleVelocityUsingAcceleration(DPSFDefaultBaseParticle cParticle, float fElapsedTimeInSeconds)
 {
     // Update the Particle's Position according to its Velocity
     cParticle.Velocity += cParticle.Acceleration * fElapsedTimeInSeconds;
 }
示例#14
0
        //===========================================================
        // Particle Update Functions
        //===========================================================

        /// <summary>
        /// Update a Particle's Position according to its Velocity
        /// </summary>
        /// <param name="cParticle">The Particle to update</param>
        /// <param name="fElapsedTimeInSeconds">How long it has been since the last update</param>
        protected void UpdateParticlePositionUsingVelocity(DPSFDefaultBaseParticle cParticle, float fElapsedTimeInSeconds)
        {
            // Update the Particle's Position according to its Velocity
            cParticle.Position += cParticle.Velocity * fElapsedTimeInSeconds;
        }
示例#15
0
        /// <summary>
        /// Function to Initialize a Default Particle with the Initial Settings
        /// </summary>
        /// <param name="Particle">The Particle to be Initialized</param>
        /// <param name="cInitialProperties">The Initial Settings to use to Initialize the Particle</param>
        public void InitializeParticleUsingInitialProperties(DPSFParticle Particle, CInitialProperties cInitialProperties)
        {
            // Cast the Particle to the type it really is
            DPSFDefaultBaseParticle cParticle = (DPSFDefaultBaseParticle)Particle;

            // Initialize the Particle according to the values specified in the Initial Settings
            cParticle.Lifetime = DPSFHelper.RandomNumberBetween(cInitialProperties.LifetimeMin, cInitialProperties.LifetimeMax);

            // If the Position should be interpolated between the Min and Max Positions
            if (cInitialProperties.InterpolateBetweenMinAndMaxPosition)
            {
                cParticle.Position = Vector3.Lerp(cInitialProperties.PositionMin, cInitialProperties.PositionMax, RandomNumber.NextFloat());
            }
            // Else the Position XYZ values should each be calculated individually
            else
            {
                cParticle.Position = DPSFHelper.RandomVectorBetweenTwoVectors(cInitialProperties.PositionMin, cInitialProperties.PositionMax);
            }

            // If the Particle's Velocity should be affected by the Emitters Orientation
            if (cInitialProperties.VelocityIsAffectedByEmittersOrientation)
            {
                // Rotate the Particle around the Emitter according to the Emitters orientation
                cParticle.Position = Vector3.Transform(cParticle.Position, Emitter.OrientationData.Orientation);
            }

            // If the Particle should be affected by the Emitters Position
            if (cInitialProperties.PositionIsAffectedByEmittersPosition)
            {
                // Add the Emitter's Position to the Particle's Position
                cParticle.Position += Emitter.PositionData.Position;
            }

            // If the Velocity should be interpolated between the Min and Max Velocity
            if (cInitialProperties.InterpolateBetweenMinAndMaxVelocity)
            {
                cParticle.Velocity = Vector3.Lerp(cInitialProperties.VelocityMin, cInitialProperties.VelocityMax, RandomNumber.NextFloat());
            }
            // Else the Velocity XYZ values should each be calculated individually
            else
            {
                cParticle.Velocity = DPSFHelper.RandomVectorBetweenTwoVectors(cInitialProperties.VelocityMin, cInitialProperties.VelocityMax);
            }

            // Have the Emitters Rotation affect the Particle's starting Velocity
            cParticle.Velocity = Vector3.Transform(cParticle.Velocity, Emitter.OrientationData.Orientation);

            // If the Acceleration should be interpolated between the Min and Max Acceleration
            if (cInitialProperties.InterpolateBetweenMinAndMaxAcceleration)
            {
                cParticle.Acceleration = Vector3.Lerp(cInitialProperties.AccelerationMin, cInitialProperties.AccelerationMax, RandomNumber.NextFloat());
            }
            // Else the Acceleration XYZ values should each be calculated individually
            else
            {
                cParticle.Acceleration = DPSFHelper.RandomVectorBetweenTwoVectors(cInitialProperties.AccelerationMin, cInitialProperties.AccelerationMax);
            }

            // If the External Force should be interpolated between the Min and Max External Force
            if (cInitialProperties.InterpolateBetweenMinAndMaxExternalForce)
            {
                cParticle.ExternalForce = Vector3.Lerp(cInitialProperties.ExternalForceMin, cInitialProperties.ExternalForceMax, RandomNumber.NextFloat());
            }
            // Else the External Force XYZ values should each be calculated individually
            else
            {
                cParticle.ExternalForce = DPSFHelper.RandomVectorBetweenTwoVectors(cInitialProperties.ExternalForceMin, cInitialProperties.ExternalForceMax);
            }

            // Calculate the amount of Friction to use
            cParticle.Friction = DPSFHelper.RandomNumberBetween(cInitialProperties.FrictionMin, cInitialProperties.FrictionMax);

            // If the new Color values should be somewhere between the interpolation of the Min and Max Colors
            if (cInitialProperties.InterpolateBetweenMinAndMaxColors)
            {
                cParticle.StartColor = DPSFHelper.LerpColor(cInitialProperties.StartColorMin, cInitialProperties.StartColorMax, RandomNumber.NextFloat());
                cParticle.EndColor   = DPSFHelper.LerpColor(cInitialProperties.EndColorMin, cInitialProperties.EndColorMax, RandomNumber.NextFloat());
            }
            // Else the RGBA Color values should each be randomly calculated individually
            else
            {
                cParticle.StartColor = DPSFHelper.LerpColor(cInitialProperties.StartColorMin, cInitialProperties.StartColorMax, RandomNumber.NextFloat(), RandomNumber.NextFloat(), RandomNumber.NextFloat(), RandomNumber.NextFloat());
                cParticle.EndColor   = DPSFHelper.LerpColor(cInitialProperties.EndColorMin, cInitialProperties.EndColorMax, RandomNumber.NextFloat(), RandomNumber.NextFloat(), RandomNumber.NextFloat(), RandomNumber.NextFloat());
            }
            cParticle.Color = cParticle.StartColor;
        }