Beispiel #1
0
        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.CornflowerBlue);

            // TODO: Add your drawing code here
            this.spriteBatch.Begin(SpriteSortMode.FrontToBack, BlendState.AlphaBlend);

            if (currentGameState == GameStateEnum.GAME_MENU)
            {
                menu.Draw(gameTime, spriteBatch);
            }

            #region draw unit
            if (currentGameState == GameStateEnum.GAME_PLAYING || /*|| currentGameState == GameStateEnum.GAME_LOAD*/
                currentGameState == GameStateEnum.GAME_START || currentGameState == GameStateEnum.SHOW_RESULT)
            {
                subMenu.Draw(gameTime, spriteBatch);
                Global.map.Draw(gameTime, spriteBatch);
                int n = monsterList.Count;
                for (int i = 0; i < n; i++)
                {
                    monsterList[i].Draw(gameTime, spriteBatch);
                }

                n = treasureList.Count;
                for (int i = 0; i < n; i++)
                {
                    treasureList[i].Draw(gameTime, spriteBatch);
                }

                player.Draw(gameTime, spriteBatch);
            }
            #endregion

            if (currentGameState == GameStateEnum.SHOW_RESULT)
            {
                resultDialog.Draw(gameTime, spriteBatch);
            }
            if (currentGameState == GameStateEnum.GAME_END)
            {
                confirmDialog.Draw(gameTime, spriteBatch);
            }
            if (dialogEven == DialogEnum.SHOW_ANNOUNCE)
            {
                annouceDialog.Draw(gameTime, spriteBatch);
            }
            if (dialogEven == DialogEnum.INPUTTEXT)
            {
                inputDialog.Draw(gameTime, spriteBatch);
            }
            this.spriteBatch.End();
            base.Draw(gameTime);
        }