Project_Starfighter.AnimatedSprite.Update C# (CSharp) Méthode

Update() public méthode

public Update ( GameTime gametime ) : void
gametime Microsoft.Xna.Framework.GameTime
Résultat void
        public void Update(GameTime gametime)
        {
            if (isFrameAnimated)
            {
                // see what was the elapsed time
                elapsedTime += (float)gametime.ElapsedGameTime.TotalSeconds;

                // check if the time elapsed is bigger than the frame rate
                if (elapsedTime > rateOfFrame)
                {
                    // increment the current frame
                    currentFrame = (currentFrame + 1) % numberOfFrames;

                    // reset the elapsed time for the frame
                    elapsedTime = 0.0f;
                }
            }
        }