public void Unload() { parentGame.Components.Remove(debugDrawer); debugDrawer = null; }
public DrawingClass(ParentGame parentGame, GameplayScreen levelVariables, List<Missile> BulletList, List<Building> BuildingList, List<BuildingPiece> PieceList) { this.parentGame = parentGame; this.LV = levelVariables; this.BulletList = BulletList; this.BuildingList = BuildingList; this.PieceList = PieceList; device = parentGame.GraphicsDevice; PresentationParameters PP = device.PresentationParameters; spriteBatch = parentGame.spriteBatch; windowHeight = PP.BackBufferHeight; windowWidth = PP.BackBufferWidth; objEffect = parentGame.objEffect; //shadowMapShader = parentGame.Content.Load<Effect>("Effect\\DrawShadowMap"); GausBlur = parentGame.Content.Load<Effect>("Effect\\GaussianBlur"); effectPostDoF = parentGame.Content.Load<Effect>("Effect\\PostProcessDoF"); depthMapShader = parentGame.Content.Load<Effect>("Effect\\Shader"); font = parentGame.Content.Load<SpriteFont>("Font\\SpriteFont1"); Lines = parentGame.Content.Load<Texture2D>("Radar\\lines3"); Post = parentGame.Content.Load<Texture2D>("Radar\\post_screen"); PowerBar = parentGame.Content.Load<Texture2D>("Radar\\power_bar"); PowerCase = parentGame.Content.Load<Texture2D>("Radar\\power_case"); Bullets = parentGame.Content.Load<Texture2D>("Radar\\bullets"); Angle = parentGame.Content.Load<Texture2D>("Radar\\angle"); WinBack = parentGame.Content.Load<Texture2D>("WinLoose\\win_back"); LooseBack = parentGame.Content.Load<Texture2D>("WinLoose\\loose_back"); TitlesFont = parentGame.Content.Load<SpriteFont>("Font\\sten36bld"); TitlesFont2 = parentGame.Content.Load<SpriteFont>("Font\\Titles_font2"); FireworkSheet = parentGame.Content.Load<Texture2D>("Firework\\firework_sheet"); Timer = parentGame.Content.Load<Texture2D>("Radar\\timer"); blurredScene = new Texture2D(device, windowWidth, windowHeight); depthTexture = new Texture2D(device, windowWidth, windowHeight); sceneTexture = new Texture2D(device, windowWidth, windowHeight); InitializeRenderTargets(); InitializeParticles(); lightPower = 0.9f; ambientPower = 0.2f; debugDrawer = new DebugDrawer(parentGame); debugDrawer.Enabled = true; parentGame.Components.Add(debugDrawer); SpecularColor = Color.Purple.ToVector4(); SpecularIntensity = 1.0f; Shinniness = 500.0f; float screenscale = (float)device.Viewport.Width / 848f; // Create the scale transform for Draw. // Do not scale the sprite depth (Z=1). SpriteScale = Matrix.CreateScale(screenscale, screenscale, 1); ssX = screenscale; WLScale.X = (float)device.Viewport.Width / 800f; WLScale.Y = (float)device.Viewport.Height / 600f; InitializeBones(); boundFrustum = new BoundingFrustum(viewMatrix * projectionMatrix); }