/// <summary> /// Loads all of the content needed by the game. All of this should have already been cached /// into the ContentManager by the LoadingScreen. /// </summary> public override void LoadContent() { backMusic = ScreenManager.Game.Content.Load<Song>("backmusic"); cloud1Texture = ScreenManager.Game.Content.Load<Texture2D>("cloud1"); cloud2Texture = ScreenManager.Game.Content.Load<Texture2D>("cloud2"); sunTexture = ScreenManager.Game.Content.Load<Texture2D>("sun"); moonTexture = ScreenManager.Game.Content.Load<Texture2D>("moon"); groundTexture = ScreenManager.Game.Content.Load<Texture2D>("ground"); tankTexture = ScreenManager.Game.Content.Load<Texture2D>("tank"); mountainsTexture = ScreenManager.Game.Content.Load<Texture2D>("mountains_blurred"); hillsTexture = ScreenManager.Game.Content.Load<Texture2D>("hills"); alienTexture = ScreenManager.Game.Content.Load<Texture2D>("alien1"); badguy_blue = ScreenManager.Game.Content.Load<Texture2D>("badguy_blue"); badguy_red = ScreenManager.Game.Content.Load<Texture2D>("badguy_red"); badguy_green = ScreenManager.Game.Content.Load<Texture2D>("badguy_green"); badguy_orange = ScreenManager.Game.Content.Load<Texture2D>("badguy_orange"); bulletTexture = ScreenManager.Game.Content.Load<Texture2D>("bullet"); laserTexture = ScreenManager.Game.Content.Load<Texture2D>("laser"); alienFired = ScreenManager.Game.Content.Load<SoundEffect>("Tank_Fire"); alienDied = ScreenManager.Game.Content.Load<SoundEffect>("Alien_Hit"); playerFired = ScreenManager.Game.Content.Load<SoundEffect>("Tank_Fire"); playerDied = ScreenManager.Game.Content.Load<SoundEffect>("Player_Hit"); scoreFont = ScreenManager.Game.Content.Load<SpriteFont>("ScoreFont"); menuFont = ScreenManager.Game.Content.Load<SpriteFont>("menufont"); player.Width = tankTexture.Width; player.Height = tankTexture.Height; cloud1Position = new Vector2(224 - cloud1Texture.Width, 32); cloud2Position = new Vector2(64, 80); sunPosition = new Vector2(16, 16); particles = new ParticleSystem(ScreenManager.Game.Content, ScreenManager.SpriteBatch); LoadHighscore(); base.LoadContent(); // Automatically start the game once all loading is done Start(); }
/// <summary> /// Save the scores and dispose of the particles /// </summary> public override void UnloadContent() { particles = null; base.UnloadContent(); }
/// <summary> /// Save the scores and dispose of the particles /// </summary> public override void UnloadContent() { SaveHighscore(); particles = null; base.UnloadContent(); }