예제 #1
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
            DefaultAnimatedTexturedQuadParticle cParticleToCopy = (DefaultAnimatedTexturedQuadParticle)ParticleToCopy;

            base.CopyFrom(ParticleToCopy);
            Animation.CopyFrom(cParticleToCopy.Animation);
        }
예제 #2
0
        //===========================================================
        // Particle Update Functions
        //===========================================================

        /// <summary>
        /// Updates the Animation, as well as the Particle's Texture Coordinates to match the Animation
        /// </summary>
        /// <param name="cParticle">The Particle to update</param>
        /// <param name="fElapsedTimeInSeconds">How long it has been since the last update</param>
        protected void UpdateParticleAnimationAndTextureCoordinates(DefaultAnimatedTexturedQuadParticle cParticle, float fElapsedTimeInSeconds)
        {
            // Update the Animation
            cParticle.Animation.Update(fElapsedTimeInSeconds);

            // Get the Particle's Texture Coordinates
            Rectangle sSourceRect = cParticle.Animation.CurrentPicturesTextureCoordinates;

            // Set the Particle's Texture Coordinates to use
            cParticle.SetTextureCoordinates(sSourceRect, Texture.Width, Texture.Height);
        }
예제 #3
0
        /// <summary>
        /// Updates the Particle to be removed from the Particle System once the Animation finishes Playing
        /// </summary>
        /// <param name="cParticle">The Particle to update</param>
        /// <param name="fElapsedTimeInSeconds">How long it has been since the last update</param>
        protected void UpdateParticleToDieOnceAnimationFinishesPlaying(DefaultAnimatedTexturedQuadParticle cParticle, float fElapsedTimeInSeconds)
        {
            // If the Animation has finished Playing
            if (cParticle.Animation.CurrentAnimationIsDonePlaying)
            {
                // Make sure the Lifetime is greater than zero
                // We make it a small value to try and keep from triggering any Timed Events by accident
                cParticle.Lifetime = 0.00001f;

                // Set the Particle to die
                cParticle.NormalizedElapsedTime = 1.0f;
            }
        }