Пример #1
0
        /// <summary>
        /// Updates the game.
        /// </summary>
        /// <param name="gameTime">The game time.</param>
        protected override void Update(GameTime gameTime)
        {
            //updates tools game time
            Tools.GameTime = gameTime;

            //chooses the appropriate state to update
            switch (State)
            {
            case GameState.Game:
                GameScene.Update();
                IsMouseVisible = false;
                graphics.ApplyChanges();
                break;

            case GameState.Shop:
                Shop.Instance.Update();
                IsMouseVisible = true;
                graphics.ApplyChanges();
                break;

            case GameState.Menu:
                Menu.Update(this);
                IsMouseVisible = true;
                graphics.ApplyChanges();
                break;

            case GameState.LoseScreen:
                LoseScreen.Update();
                IsMouseVisible = true;
                graphics.ApplyChanges();
                break;

            case GameState.Pause:
                PauseMenu.Update();
                IsMouseVisible = true;
                graphics.ApplyChanges();
                break;

            case GameState.Instructions:
                Instructions.Update();
                break;
            }

            base.Update(gameTime);
        }
Пример #2
0
        /// <summary>
        /// Draws the specified game time.
        /// </summary>
        /// <param name="gameTime">The game time.</param>
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.CornflowerBlue);

            //chooses the appropriate state to draw
            switch (State)
            {
            case GameState.Game:
                GameScene.Draw(spriteBatch);
                break;

            case GameState.Shop:
                GameScene.Draw(spriteBatch);
                Shop.Instance.Draw(spriteBatch);
                break;

            case GameState.Menu:
                Menu.Draw(spriteBatch);
                break;

            case GameState.LoseScreen:
                GameScene.Draw(spriteBatch);
                LoseScreen.Draw(spriteBatch);
                break;

            case GameState.Pause:
                GameScene.Draw(spriteBatch);
                PauseMenu.Draw(spriteBatch);
                break;

            case GameState.Instructions:
                Instructions.Draw(spriteBatch);
                break;
            }

            base.Draw(gameTime);
        }