/// <summary> /// Loads the level from the content manager /// </summary> /// <param name="content">Content Manager to load from</param> public void Load(ContentManager content, string assetName) { _mKootenay = content.Load<SpriteFont>("fonts/Kootenay"); _mQuartz = content.Load<SpriteFont>("fonts/QuartzLarge"); // mDirections = new Texture2D[4]; // mDirections[3] = content.Load<Texture2D>("HUD/arrow_left"); // mDirections[2] = content.Load<Texture2D>("HUD/arrow_down"); // mDirections[1] = content.Load<Texture2D>("HUD/arrow_right"); // mDirections[0] = content.Load<Texture2D>("HUD/arrow_up"); _mRailLeft = content.Load<Texture2D>("Images/NonHazards/Rails/RailLeft"); _mRailHor = content.Load<Texture2D>("Images/NonHazards/Rails/RailHorizontal"); _mRailRight = content.Load<Texture2D>("Images/NonHazards/Rails/RailRight"); _mRailTop = content.Load<Texture2D>("Images/NonHazards/Rails/RailTop"); _mRailBottom = content.Load<Texture2D>("Images/NonHazards/Rails/RailBottom"); _mRailVert = content.Load<Texture2D>("Images/NonHazards/Rails/RailVertical"); _mContent = content; MNumCollected = 0; MNumCollectable = 0; // Particle Engine var textures = new List<Texture2D>(); textures.Add(content.Load<Texture2D>("Images/Particles/diamond")); textures.Add(content.Load<Texture2D>("Images/Particles/star")); _collectibleEngine = new ParticleEngine.ParticleEngine(textures, new Vector2(400, 240), 20); _collectibleEngine.ColorScheme = "Yellow"; textures = new List<Texture2D>(); textures.Add(content.Load<Texture2D>("Images/Particles/line")); textures.Add(content.Load<Texture2D>("Images/Particles/square")); _wallEngine = new ParticleEngine.ParticleEngine(textures, new Vector2(400, 240), 20); _wallEngine.ColorScheme = "Blue"; _backGroundParticleCount = 500; _backgroundParticles = new Particle[_backGroundParticleCount]; var random = new Random(); var particle = content.Load<Texture2D>("Images/Particles/diamond"); for (var i = 0; i < _backGroundParticleCount; i++) { var pos = new Vector2(random.Next(-(int)(_mBounds.Width + Size.X) / 2, 3 * (int)(_mBounds.Width + Size.X) / 2), random.Next(-(int)(_mBounds.Height + Size.Y) / 2, 3 * (int)(_mBounds.Height + Size.Y) / 2)); _backgroundParticles[i] = new Particle(particle, pos, random); } //lastCollided = new GameObject[2]; //lastCollided[0] = lastCollided[1] = null; _lastCollided = null; _mCollectableLocations = new List<Vector2>(); }
public void Dispose() { _mActiveAnimations.Clear(); _backgroundParticles = null; var temp = _mObjects.Capacity; _mObjects.Clear(); _mObjects.TrimExcess(); _mCollisionMatrix = null; _mTrigger.Clear(); _mTrigger.TrimExcess(); _collectibleEngine = null; _wallEngine = null; _mContent = null; if (_mCollectableLocations != null) { _mCollectableLocations.Clear(); _mCollectableLocations.TrimExcess(); } GC.Collect(); }