예제 #1
0
        /// <summary>
        /// Handles changes to the ForwardDirection property.
        /// </summary>
        /// <param name="d">
        /// The <see cref="DependencyObject"/> on which
        /// the property has changed value.
        /// </param>
        /// <param name="e">
        /// Event data that is issued by any event that
        /// tracks changes to the effective value of this property.
        /// </param>
        private static void OnForwardDirectionChanged(
            DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            var target = (WipeTransition)d;
            DirectionOfMotion oldForwardDirection = (DirectionOfMotion)e.OldValue;
            DirectionOfMotion newForwardDirection = target.ForwardDirection;

            target.OnForwardDirectionChanged(oldForwardDirection, newForwardDirection);
        }
예제 #2
0
        /// <summary>
        /// Provides derived classes an opportunity to handle changes
        /// to the ForwardDirection property.
        /// </summary>
        /// <param name="oldForwardDirection">The old ForwardDirection value</param>
        /// <param name="newForwardDirection">The new ForwardDirection value</param>
        protected virtual void OnForwardDirectionChanged(
            DirectionOfMotion oldForwardDirection, DirectionOfMotion newForwardDirection)
        {
            if (this.ForwardInAnimation != null)
            {
                ((WipeAnimation)this.ForwardInAnimation).Direction = newForwardDirection;
            }

            if (this.ForwardOutAnimation != null)
            {
                ((WipeAnimation)this.ForwardOutAnimation).Direction = newForwardDirection;
            }
        }
        /// <summary>
        /// Provides derived classes an opportunity to handle changes
        /// to the ForwardDirection property.
        /// </summary>
        /// <param name="oldForwardDirection">The old ForwardDirection value</param>
        /// <param name="newForwardDirection">The new ForwardDirection value</param>
        protected virtual void OnForwardDirectionChanged(
            DirectionOfMotion oldForwardDirection, DirectionOfMotion newForwardDirection)
        {
            if (this.ForwardInAnimation != null)
            {
                ((FlipAnimation)this.ForwardInAnimation).Direction = newForwardDirection;
            }

            if (this.ForwardOutAnimation != null)
            {
                ((FlipAnimation)this.ForwardOutAnimation).Direction = newForwardDirection;
            }
        }
        /// <summary>
        /// Provides derived classes an opportunity to handle changes
        /// to the BackwardDirection property.
        /// </summary>
        /// <param name="oldBackwardDirection">The old BackwardDirection value</param>
        /// <param name="newBackwardDirection">The new BackwardDirection value</param>
        protected virtual void OnBackwardDirectionChanged(
            DirectionOfMotion oldBackwardDirection, DirectionOfMotion newBackwardDirection)
        {
            if (this.BackwardInAnimation != null)
            {
                ((FlipAnimation)this.BackwardInAnimation).Direction = newBackwardDirection;
            }

            if (this.BackwardOutAnimation != null)
            {
                ((FlipAnimation)this.BackwardOutAnimation).Direction = newBackwardDirection;
            }
        }
예제 #5
0
        public override void Update(GameTime gameTime)
        {
            KeyboardState keyboard = Keyboard.GetState();

            if (System.Environment.TickCount - LastTickCount > Timer - Speed)
            {
                LastTickCount = System.Environment.TickCount;
                UpdateStatus();
            }


            if (keyboard.IsKeyDown(Keys.D) || keyboard.IsKeyDown(Keys.Right))
            {
                directionOfmotion = DirectionOfMotion.Rigth;
                Move();

                return;
            }
            else if (keyboard.IsKeyDown(Keys.A) || keyboard.IsKeyDown(Keys.Left))
            {
                directionOfmotion = DirectionOfMotion.Left;
                Move();

                return;
            }
            else if (keyboard.IsKeyDown(Keys.W) || keyboard.IsKeyDown(Keys.Up))
            {
                directionOfmotion = DirectionOfMotion.Up;
                Move();

                return;
            }
            else if (keyboard.IsKeyDown(Keys.S) || keyboard.IsKeyDown(Keys.Down))
            {
                directionOfmotion = DirectionOfMotion.Down;
                Move();

                return;
            }
            this.Moving = false;

            base.Update(gameTime);
        }
        /// <summary>
        /// Provides derived classes an opportunity to handle changes
        /// to the BackwardDirection property.
        /// </summary>
        /// <param name="oldBackwardDirection">The old BackwardDirection value</param>
        /// <param name="newBackwardDirection">The new BackwardDirection value</param>
        protected virtual void OnBackwardDirectionChanged(
            DirectionOfMotion oldBackwardDirection, DirectionOfMotion newBackwardDirection)
        {
            if (this.BackwardInAnimation != null)
            {
                ((SlideAnimation)this.BackwardInAnimation).Direction = newBackwardDirection;
            }

            if (this.BackwardOutAnimation != null)
            {
                ((SlideAnimation)this.BackwardOutAnimation).Direction = newBackwardDirection;
            }
        }