public void UpdateWindowSize(GraphicsDevice graphicsDevice, int width, int height)
 {
     FriendlyLayer.UpdateWindowSize(graphicsDevice, width, height);
     EnemyLayer.UpdateWindowSize(graphicsDevice, width, height);
     NebulaLayer.UpdateWindowSize(graphicsDevice, width, height);
     TmpTarget = new RenderTarget2D(graphicsDevice, width, height);
 }
 public void DrawEnemyLayer(SpriteBatch sB)
 {
     if (EnemyLayer.Metaballs.Count > 0 || EnemyLayer.Sprites.Count > 0)
     {
         sB.End();
         EnemyLayer.DrawLayer(sB);
         sB.Begin(SpriteSortMode.Deferred, null, null, null, null, null, Main.GameViewMatrix.TransformationMatrix);
     }
 }
        public void DrawToTarget(SpriteBatch sB, GraphicsDevice graphicsDevice)
        {
            var prevTarget = graphicsDevice.GetRenderTargets();

            if (FriendlyLayer.Metaballs.Count > 0 || FriendlyLayer.Sprites.Count > 0)
            {
                FriendlyLayer.DrawMetaballTarget(sB, graphicsDevice);
            }

            if (EnemyLayer.Metaballs.Count > 0 || EnemyLayer.Sprites.Count > 0)
            {
                EnemyLayer.DrawMetaballTarget(sB, graphicsDevice);
            }

            if (NebulaLayer.Metaballs.Count > 0 || NebulaLayer.Sprites.Count > 0)
            {
                NebulaLayer.DrawMetaballTarget(sB, graphicsDevice);
            }

            graphicsDevice.SetRenderTargets(prevTarget);
        }