Exemplo n.º 1
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);
        }
Exemplo n.º 2
0
 public void HandleDynamicCollision(string collisionDirection, IDynamicObject dynamicObjectState)
 {
     if (Mario.Instance.PlayableObjectState.ToString() != "SuperMario.MarioStates.DeadMario")
     {
         PlayableObjectStateTransitionMachine.DynamicStateChange(collisionDirection, PlayableObjectState.ToString(), dynamicObjectState);
     }
 }