Ejemplo n.º 1
0
        /// <summary>
        /// Initialize the animation, sets the appropriate values depending on the animation type.
        /// </summary>
        /// <param name="animation">The animation type.</param>
        /// <param name="time">How long the animation takes.</param>
        private void InitializeAnimation(GameConsoleAnimation animation, float time)
        {
            if (animation == GameConsoleAnimation.None) {
                _animationTime = 0.0f;
                return;
            }

            if ((animation & GameConsoleAnimation.Fade) == GameConsoleAnimation.Fade) {
                //animationBackgroundAlpha = backgroundAlpha;
                //animationTextAlpha = textAlpha;
            }

            if ((animation & GameConsoleAnimation.SlideTop) == GameConsoleAnimation.SlideTop ||
                (animation & GameConsoleAnimation.SlideBottom) == GameConsoleAnimation.SlideBottom) {
                _animationPosition = _bounds.Y;
            }
            else if ((animation & GameConsoleAnimation.SlideLeft) == GameConsoleAnimation.SlideLeft ||
                     (animation & GameConsoleAnimation.SlideRight) == GameConsoleAnimation.SlideRight) {
                _animationPosition = _bounds.X;
            }

            _animationTime = time;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Cleans the animation up, resets the appropriate values depending on the animation type.
        /// </summary>
        /// <param name="animation">The animation type.</param>
        private void AnimationCleanUp(GameConsoleAnimation animation)
        {
            if (animation == GameConsoleAnimation.None) {
                return;
            }

            if ((animation & GameConsoleAnimation.Fade) == GameConsoleAnimation.Fade) {
                //backgroundAlpha = animationBackgroundAlpha;
                //textAlpha = animationTextAlpha;
            }

            if ((animation & GameConsoleAnimation.SlideTop) == GameConsoleAnimation.SlideTop ||
                (animation & GameConsoleAnimation.SlideBottom) == GameConsoleAnimation.SlideBottom) {
                Bounds = new Rectangle(_bounds.X, _animationPosition, _bounds.Width, _bounds.Height);
            }
            else if ((animation & GameConsoleAnimation.SlideLeft) == GameConsoleAnimation.SlideLeft ||
                     (animation & GameConsoleAnimation.SlideRight) == GameConsoleAnimation.SlideRight) {
                Bounds = new Rectangle(_animationPosition, _bounds.Y, _bounds.Width, _bounds.Height);
            }
        }