protected override void UnloadContent() { accelSensor = null; indicator = null; basketLeft = null; basketOpeningLeft = null; basketRight = null; mama = null; boy = null; toy = null; talkingBubble = null; gameStorage = null; toysBackground = null; toysForeground = null; toyName = null; gameStorage = null; spriteBatch = null; mannTexture = null; mannTexture2 = null; mannTexture3 = null; basketTxt = null; boyDissapointedTxt = null; roomTexture = null; crayonTxt = null; guiBubbleTxt = null; basketLeftTxt = null; basketOpeningTxt = null; loadScreen = null; pauseScreenTxt = null; indicatorTxt = null; resumeTxt = null; restartTxt = null; pauseButtonTxt = null; menuButtonTxt = null; mamaTxt = null; roomdooropen = null; mannRect = Rectangle.Empty; bskHit = Rectangle.Empty; basketLeftRect = Rectangle.Empty; mannRect2 = Rectangle.Empty; mannRect3 = Rectangle.Empty; defaultRect = Rectangle.Empty; roomRect = Rectangle.Empty; indicatorRct = Rectangle.Empty; crayonRect = Rectangle.Empty; guiBubbleRct = Rectangle.Empty; basketOpeningRct = Rectangle.Empty; basketRightRect = Rectangle.Empty; basketOpeningLRct = Rectangle.Empty; basketOpeningRRct = Rectangle.Empty; bskHitL = Rectangle.Empty; bskHitR = Rectangle.Empty; pauseScreenRect = Rectangle.Empty; restartRect = Rectangle.Empty; resumeRect = Rectangle.Empty; pauseButtonRect = Rectangle.Empty; menuButtonRect = Rectangle.Empty; mamaRct = Rectangle.Empty; mannRect4 = Rectangle.Empty; gameGUI = null; colorList = null; rnd = null; toy = null; spriteFont = null; boy = null; roomBackground = null; basketOpening = null; basketOpeningLeft = null; basketOpeningRight = null; basketRight = null; pauseScreen = null; resumeButton = null; restartButton = null; pauseButton = null; menuButton = null; indicator = null; mama = null; Components.Clear(); for (int i = 0; i < rectangles.Length; i++) { rectangles[i] = Rectangle.Empty; } if (crayons != null) { for (int c = 0; c < crayons.Length; c++) { crayons[c] = null; } } crayons = null; backgroundMusic = null; yeah = null; ohno = null; myBoy = null; toysCollected.Clear(); toysCollected = null; yeahinst = null; ohnoinst = null; backgroundMusicInst = null; myBoyInst = null; graphics = null; vibration = null; gameMS = null; toysBackground = null; toysForeground = null; toyName = string.Empty; toyNamePrefix = string.Empty; musicStateStopped = string.Empty; for (int r = 0; r < rectangles.Length; r++) rectangles[r] = Rectangle.Empty; Content.Unload(); while (Components.Count > 0) Components.RemoveAt(0); for (int txt = 0; txt < textures.Length; txt++) { textures[txt] = null; } textures = null; unLoadPauseScreen(); base.UnloadContent(); string test = GC.GetTotalMemory(true).ToString(); }
protected void addToys(int vertRangeMinFG, int vertRangeMaxFG, int horRangeMinFG, int horRangeMaxFG, int vertRangeMinBG, int vertRangeMaxBG, int horRangeMinBG, int horRangeMaxBG, bool randomRotation, bool randomColors, int foreGroundGraphicsDrawOrder, int backgroundGraphicsDrawOrder, bool randomMizeMoreThanOne) { toysCollected = new List<int>(); for (int i = 0; i < textures.Count; i++) { toysCollected.Add(i); } List<float> rots = new List<float>(); List<Color> colors = new List<Color>(); List<Texture2D> graphicsBackground = new List<Texture2D>(); List<Rectangle> rectanglesBackground = new List<Rectangle>(); if (randomMizeMoreThanOne == true) { List<Texture2D> graphicsForeGround = new List<Texture2D>(); List<Rectangle> rectanglesForeground = new List<Rectangle>(); randomMizeGraphics(textures, rectangles, ref rectanglesBackground, ref rectanglesForeground, ref graphicsBackground, ref graphicsForeGround); toysBackground = new Graphics(this.Game, graphicsBackground, rectanglesBackground, randomRotation, randomColors, vertRangeMinBG, vertRangeMaxBG, horRangeMinBG, horRangeMaxBG); toysForeground = new Graphics(this.Game, graphicsForeGround, rectanglesForeground, randomRotation, randomColors, vertRangeMinFG, vertRangeMaxFG, horRangeMinFG, horRangeMaxFG); toysForeground.DrawOrder = foreGroundGraphicsDrawOrder; Components.Add(toysForeground); } else { addGraphics(textures, rectangles, ref rectanglesBackground, ref graphicsBackground); } toysBackground = new Graphics(this.Game, graphicsBackground, rectanglesBackground, randomRotation, randomColors, vertRangeMinBG, vertRangeMaxBG, horRangeMinBG, horRangeMaxBG); toysBackground.DrawOrder = backgroundGraphicsDrawOrder; Components.Add(toysBackground); }
protected void addToys(int vertRangeMinFG, int vertRangeMaxFG, int horRangeMinFG, int horRangeMaxFG, int vertRangeMinBG, int vertRangeMaxBG, int horRangeMinBG, int horRangeMaxBG, bool randomRotation, bool randomColors, int foreGroundGraphicsDrawOrder, int backgroundGraphicsDrawOrder, bool randomMizeMoreThanOne) { toysCollected = new List<int>(); for (int i = 0; i < textures.Length; i++) { toysCollected.Add(i); } if (randomMizeMoreThanOne == true) { int array1Length = rnd.Next(0, toyCount+1); int array2Length = toyCount - array1Length; Texture2D[] graphicsBackground = new Texture2D[array1Length]; Rectangle[] rectanglesBackground = new Rectangle[array1Length]; Texture2D[] graphicsForeGround = new Texture2D[array2Length]; Rectangle[] rectanglesForeground = new Rectangle[array2Length]; randomMizeGraphics(textures, rectangles, ref rectanglesBackground, ref rectanglesForeground, ref graphicsBackground, ref graphicsForeGround); toysBackground = new Graphics(this.Game, graphicsBackground, rectanglesBackground, randomRotation, randomColors, vertRangeMinBG, vertRangeMaxBG, horRangeMinBG, horRangeMaxBG); toysForeground = new Graphics(this.Game, graphicsForeGround, rectanglesForeground, randomRotation, randomColors, vertRangeMinFG, vertRangeMaxFG, horRangeMinFG, horRangeMaxFG); toysForeground.DrawOrder = foreGroundGraphicsDrawOrder; Components.Add(toysForeground); } else { Texture2D[] graphicsBackground = new Texture2D[toyCount]; Rectangle[] rectanglesBackground = new Rectangle[toyCount]; addGraphics(textures, rectangles, ref rectanglesBackground, ref graphicsBackground); toysBackground = new Graphics(this.Game, graphicsBackground, rectanglesBackground, randomRotation, randomColors, vertRangeMinBG, vertRangeMaxBG, horRangeMinBG, horRangeMaxBG); } toysBackground.DrawOrder = backgroundGraphicsDrawOrder; Components.Add(toysBackground); }