Esempio n. 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
            DefaultAnimatedSpriteParticle cParticleToCopy = (DefaultAnimatedSpriteParticle)ParticleToCopy;

            base.CopyFrom(cParticleToCopy);
            Animation.CopyFrom(cParticleToCopy.Animation);
        }
Esempio n. 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(DefaultAnimatedSpriteParticle cParticle, float fElapsedTimeInSeconds)
        {
            // Update the Animation
            cParticle.Animation.Update(fElapsedTimeInSeconds);

            // Get the Particle's Texture Coordinates to use
            cParticle.TextureCoordinates = cParticle.Animation.CurrentPicturesTextureCoordinates;
        }
Esempio n. 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(DefaultAnimatedSpriteParticle 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.000001f;

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