예제 #1
0
        public void Update(GameTime gameTime)
        {
            game.gameHUD.Update(gameTime);
            Rectangle prevRect = prevState.GetBoundingBox(mario.position);
            Rectangle newRect  = newState.GetBoundingBox(mario.position);

            timer--;
            if (currentState == prevState && timer % timeMod == 0)
            {
                currentState      = newState;
                mario.state       = newState;
                mario.position.Y -= (newRect.Height - prevRect.Height);
            }
            else if (timer % timeMod == 0 && currentState == newState)
            {
                currentState      = prevState;
                mario.state       = prevState;
                mario.position.Y += (newRect.Height - prevRect.Height);
            }
            if (timer <= 0)
            {
                mario.position.Y -= (newRect.Height - prevRect.Height);
                mario.state       = newState;
                game.gameState    = new SuperMarioGameState();
            }
        }