Example #1
0
        public override void Draw(GameTime gameTime)
        {
            SpriteBatch.Begin(SpriteSortMode.FrontToBack, transformMatrix: _camera.Transform);

            foreach (var tile in _backgroundTiles)
            {
                tile.Draw(gameTime, SpriteBatch);
            }

            _mapManager.Draw(gameTime, SpriteBatch);
            _unitManager.Draw(gameTime, SpriteBatch);

            foreach (var enemy in _enemies)
            {
                enemy.Draw(gameTime, SpriteBatch);
            }

            foreach (var wall in _walls)
            {
                wall.Draw(gameTime, SpriteBatch);
            }

            SpriteBatch.End();

            switch (State)
            {
            case BattleStates.PlayerTurn:
                _gui.Draw(gameTime, SpriteBatch);
                break;

            case BattleStates.EnemyTurn:
                SpriteBatch.Begin();

                var text     = $"Enemy Turn: {_enemyTimer:00.00}";
                var position = new Vector2(BaseGame.ScreenWidth / 2, BaseGame.ScreenHeight / 2) -
                               new Vector2(_font.MeasureString(text).X / 2, _font.MeasureString(text).Y / 2);

                SpriteBatch.DrawString(_font, text, position, Color.Red);
                SpriteBatch.End();
                break;
            }
        }