public override void Draw(SpriteBatch spriteBatch, ViewportAdapter viewportAdapter)
        {
            base.Draw(spriteBatch, viewportAdapter);
            var debugMode = SceneManager.Instance.DebugMode;

            // Draw the background
            spriteBatch.Begin(transformMatrix: viewportAdapter.GetScaleMatrix(), samplerState: SamplerState.PointClamp);
            spriteBatch.Draw(_backgroundTexture, Vector2.Zero, Color.White);
            spriteBatch.End();

            // Draw the camera (with the map)
            MapManager.Instance.Draw(_camera, spriteBatch);

            spriteBatch.Begin(transformMatrix: _camera.GetViewMatrix(), samplerState: SamplerState.PointClamp);

            // Draw the crystal
            _crystal.Draw(spriteBatch);
            if (debugMode)
            {
                _crystal.DrawCollider(spriteBatch);
            }

            // Draw the player
            _player.DrawCharacter(spriteBatch);
            if (debugMode)
            {
                _player.DrawColliderBox(spriteBatch);
            }

            // Draw the enemies
            _enemies.ForEach(enemy => enemy.DrawCharacter(spriteBatch));
            if (debugMode)
            {
                _enemies.ForEach(enemy => enemy.DrawColliderBox(spriteBatch));
            }

            // Draw the projectiles
            foreach (var projectile in _projectiles)
            {
                projectile.Draw(spriteBatch);
                if (debugMode)
                {
                    spriteBatch.Draw(_projectilesColliderTexture, projectile.BoundingBox, Color.White * 0.5f);
                }
            }

            // Draw the particles
            _particleEffects.ForEach(particle => spriteBatch.Draw(particle));

            spriteBatch.End();

            // Draw the HUD and Wave Clear
            spriteBatch.Begin(transformMatrix: viewportAdapter.GetScaleMatrix(), samplerState: SamplerState.PointClamp);

            spriteBatch.DrawString(SceneManager.Instance.GameFontBig, WaveClearText, _waveClearPosition + 1 * Vector2.UnitY, Color.Black * _waveClearAlpha);
            spriteBatch.DrawString(SceneManager.Instance.GameFontBig, WaveClearText, _waveClearPosition, Color.White * _waveClearAlpha);
            _gameHud.Draw(spriteBatch);

            spriteBatch.End();
        }
Beispiel #2
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);

            if (drawHitboxes)
            {
                spriteBatch_LayerLowest.Begin(SpriteSortMode.Texture, null, null, null, null, null, MyCamera.Transform);

                lvl.DrawHitbox(spriteBatch_LayerLowest);
                ThePlayer.DrawHitbox(spriteBatch_LayerLowest);
                spriteBatch_LayerLowest.End();
            }
            else
            {
                spriteBatch_LayerLowest.Begin(SpriteSortMode.Texture, null, null, null, null, null, MyCamera.Transform);
                lvl.DrawLevel_LowestLayer(spriteBatch_LayerLowest);
                TheSpawnableEffect_List.DrawLowest(spriteBatch_LayerLowest);
                spriteBatch_LayerLowest.End();

                spriteBatch_LayerMiddle.Begin(SpriteSortMode.Texture, null, null, null, null, null, MyCamera.Transform);
                ThePlayer.DrawPlayer(spriteBatch_LayerMiddle);
                lvl.DrawLevelGameObjects(spriteBatch_LayerMiddle);
                spriteBatch_LayerMiddle.End();

                spriteBatch_LayerHighest.Begin(SpriteSortMode.Texture, null, null, null, null, null, MyCamera.Transform);
                lvl.DrawLevel_HighestLayer(spriteBatch_LayerHighest);
                TheSpawnableEffect_List.DrawHighest(spriteBatch_LayerHighest);
                spriteBatch_LayerHighest.End();



                SpriteBatch_HUD.Begin();
                TheGameHud.Draw(SpriteBatch_HUD, gameTime);
                SpriteBatch_HUD.End();
            }


            base.Draw(gameTime);
        }
Beispiel #3
0
        public override void Draw(SpriteBatch spriteBatch, ViewportAdapter viewportAdapter)
        {
            base.Draw(spriteBatch, viewportAdapter);
            var debugMode = SceneManager.Instance.DebugMode;

            _backgroundHelper.Draw(_camera, spriteBatch);

            // Draw the map
            GameMap.Instance.Draw(_camera, spriteBatch);

            spriteBatch.Begin(transformMatrix: _camera.GetViewMatrix(), samplerState: SamplerState.PointClamp);

            // Draw the shops
            for (var i = 0; i < _shops.Count; i++)
            {
                _shops[i].Draw(spriteBatch);
            }

            // Draw the checkpoints
            for (var i = 0; i < _checkpoints.Count; i++)
            {
                _checkpoints[i].Draw(spriteBatch);
            }

            // Draw the coins
            for (var i = 0; i < _coins.Count; i++)
            {
                _coins[i].CoinSprite.Draw(spriteBatch);
            }

            // Draw the player
            _player.DrawCharacter(spriteBatch);
            _player.DrawHat(spriteBatch);
            if (debugMode)
            {
                _player.DrawColliderBox(spriteBatch);
            }

            // Draw the enemies
            foreach (var enemy in _enemies)
            {
                enemy.DrawCharacter(spriteBatch);
                if (debugMode)
                {
                    enemy.DrawColliderBox(spriteBatch);
                }
                if (enemy is Boss)
                {
                    ((Boss)enemy).DrawInnerSprites(spriteBatch);
                }
            }

            // Draw the projectiles
            foreach (var projectile in _projectiles)
            {
                spriteBatch.Draw(projectile.Sprite);
                if (debugMode)
                {
                    spriteBatch.Draw(_projectilesColliderTexture, projectile.BoundingBox, Color.White * 0.5f);
                }
            }

            // Draw the particles
            SceneManager.Instance.ParticleManager.Draw(spriteBatch);

            spriteBatch.End();

            spriteBatch.Begin(transformMatrix: SceneManager.Instance.ViewportAdapter.GetScaleMatrix(),
                              samplerState: SamplerState.PointClamp);

            _player.DrawScreenFlash(spriteBatch);

            // Draw the Hud
            _gameHud.Draw(spriteBatch);

            // Draw the Boss Hud (if exists)
            ((Boss)_enemies.SingleOrDefault(enemy => enemy is Boss))?.Draw(spriteBatch);

            if (_stageCompleted)
            {
                _stageCompletedHelper.Draw(spriteBatch);
            }

            _pauseHelper.Draw(spriteBatch);

            spriteBatch.End();
        }
Beispiel #4
0
        public void Draw(SpriteBatch spriteBatch)
        {
            gameObjects.ForEach(x => x.Draw(spriteBatch));

            Hud.Draw(spriteBatch);
        }