GameStateManagement.GameScreen.UpdateTransition C# (CSharp) Метод

UpdateTransition() приватный Метод

Helper for updating the screen transition position.
private UpdateTransition ( GameTime gameTime, System.TimeSpan time, int direction ) : bool
gameTime Microsoft.Xna.Framework.GameTime
time System.TimeSpan
direction int
Результат bool
        bool UpdateTransition(GameTime gameTime, TimeSpan time, int direction)
        {
            // How much should we move by?
            float transitionDelta;

            if (time == TimeSpan.Zero)
                transitionDelta = 1;
            else
                transitionDelta = (float)(gameTime.ElapsedGameTime.TotalMilliseconds /
                                          time.TotalMilliseconds);

            // Update the transition position.
            transitionPosition += transitionDelta * direction;

            // Did we reach the end of the transition?
            if (((direction < 0) && (transitionPosition <= 0)) ||
                ((direction > 0) && (transitionPosition >= 1)))
            {
                transitionPosition = MathHelper.Clamp(transitionPosition, 0, 1);
                return false;
            }

            // Otherwise we are still busy transitioning.
            return true;
        }