Esempio n. 1
0
 public void Draw(SpriteBatch spriteBatch, GraphicsDevice graphicsDevice)
 {
     if (State is WorldState)
     {
         if (inTransition || outTransition)
         {
             Player.Draw(spriteBatch);
             if (InPrimaryWorld)
             {
                 PrimaryWorld.Draw(spriteBatch, graphicsDevice);
             }
             else
             {
                 HiddenWorld.Draw(spriteBatch, graphicsDevice);
             }
         }
         else
         {
             if (InPrimaryWorld)
             {
                 PrimaryWorld.Draw(spriteBatch, graphicsDevice);
             }
             else
             {
                 HiddenWorld.Draw(spriteBatch, graphicsDevice);
             }
             Player.Draw(spriteBatch);
         }
     }
     State.Draw(spriteBatch, graphicsDevice);
 }
Esempio n. 2
0
        public void Update(GameTime gameTime)
        {
            if (SuperMarioBros.Instance.GameStateManager.Coins == Utils.Instance.CoinsToLives)
            {
                SuperMarioBros.Instance.GameStateManager.Lives++;
            }
            State.Update(gameTime);

            PauseCooldown(gameTime);
            ResetCooldown(gameTime);

            if (State is WorldState && !Paused)
            {
                Manager.Update(gameTime);
                if (Player.IsAlive)
                {
                    if (Player.MovementState.TeleportAnimationComplete)
                    {
                        Player.Collidable = true;
                    }
                }
                else
                {
                    Player.Collidable = false;
                }
                if (inTransition && Player.MovementState.TeleportAnimationComplete)
                {
                    inTransition = false;
                    State        = new WorldTransitionState(this);
                }
                if (outTransition && Player.MovementState.TeleportAnimationComplete)
                {
                    outTransition = false;
                }

                if (InPrimaryWorld)
                {
                    PrimaryWorld.Update(gameTime);
                    Player.Update(gameTime);
                    PrimaryWorldCollisionDetection.CheckAllCollisions();
                }
                else
                {
                    HiddenWorld.Update(gameTime);
                    Player.Update(gameTime);
                    HiddenWorldCollisionDetection.CheckAllCollisions();
                }
            }
        }