Пример #1
0
        public void Update(GameTime gameTime)
        {
            // Move PC around here.
            if (Position != FuturePosition)
            {
                Move();
                Hand.IsActive = false;
            }

            // Update Hand if not moving.
            else
            {
                Hand.Update(gameTime);
            }

            PlayableObjectState.Update(gameTime);
        }
Пример #2
0
        public void Update(GameTime gameTime)
        {
            if (this.PlayableObjectState.ToString() != "SuperMario.MarioStates.SmallMarioFlagSlideEnd" && this.PlayableObjectState.ToString() != "SuperMario.MarioStates.BigMarioFlagSlideEnd" && this.PlayableObjectState.ToString() != "SuperMario.MarioStates.FireMarioFlagSlideEnd")
            {
                MaxVelocity = new Vector2(MaxHorizontalVelocity, GameValues.PhysicsMaxYVelocity);
            }
            else
            {
                MaxVelocity = new Vector2(MaxHorizontalVelocity, 0);
            }

            if (Position.Y > GameValues.MarioDeathYPosition)
            {
                if (PlayableObjectState.ToString() != "SuperMario.MarioStates.DeadMario")
                {
                    PlayableObjectState = new DeadMario(this);
                }

                Lives--;
                if (Lives >= 1)
                {
                    GameStateMachine.Instance.GameState = new MarioRespawnState();
                }
                else
                {
                    if (deathBuffer > 0)
                    {
                        deathBuffer--;
                    }
                    else
                    {
                        deathBuffer = GameValues.MarioDeathBuffer;
                        GameStateMachine.Instance.GameState = new GameOverState();
                    }
                }
            }

            if (GameStateMachine.Instance.GameState.ToString() != "SuperMario.GameStates.MarioFreezeGameAnimationState")
            {
                Physics.Move(this);
            }

            PlayableObjectStateTransitionMachine.InvisibleBarrierCollision();
            Level.Instance.InvisibleBarrier.Update();

            for (int i = 0; i < fireballs.Length; i++)
            {
                fireballs[i].Update(gameTime);
            }

            if (StarPower)
            {
                if (starBuffer > 0)
                {
                    starBuffer--;
                }
                else
                {
                    starBuffer = GameValues.MarioStarBuffer;
                    StarPower  = !StarPower;
                }
            }

            PlayableObjectState.Update(gameTime);
        }