/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { // Give the resource manager a list of resources ResourceManager = new ResourceManager(this, new List <Resource>() { #region Backgrounds new Resource(ResourceType.Texture, "Background", "GFX/Background"), #endregion #region Players new Resource(ResourceType.Texture, "BluePlayer", "GFX/Player/PlayerBlue_Frame_01"), new Resource(ResourceType.Texture, "RedPlayer", "GFX/Player/PlayerRed_Frame_01"), #endregion #region Enemies new Resource(ResourceType.Texture, "StandardGreenEnemy", "GFX/Enemy_02/Enemy02_Green_Frame_1"), new Resource(ResourceType.Texture, "StandardRedEnemy", "GFX/Enemy_02/Enemy02_Red_Frame_1"), new Resource(ResourceType.Texture, "StandardTealEnemy", "GFX/Enemy_02/Enemy02_Teal_Frame_1"), new Resource(ResourceType.Texture, "AdvancedGreenEnemy", "GFX/Enemy_01/Enemy01_Green_Frame_1"), new Resource(ResourceType.Texture, "AdvancedRedEnemy", "GFX/Enemy_01/Enemy01_Red_Frame_1"), new Resource(ResourceType.Texture, "AdvancedTealEnemy", "GFX/Enemy_01/Enemy01_Teal_Frame_1"), #endregion #region Bullets new Resource(ResourceType.Texture, "SmallPlasmaBullet", "GFX/Bullets/Plasma_Small"), #endregion #region Animations new Resource(ResourceType.Texture, "ExhaustAnimation", "GFX/Exhaust/exhaustSheet"), new Resource(ResourceType.Texture, "ExplosionAnimation", "GFX/Explosions/explosionSheet"), #endregion #region HUD new Resource(ResourceType.Texture, "HealthBar", "GFX/HUD/HealthBar"), new Resource(ResourceType.Texture, "HealthBarColour", "GFX/HUD/HealthBarColor"), #endregion #region Keys new Resource(ResourceType.Texture, "BlackWKey", "GFX/Keys/Keyboard_Black_W"), new Resource(ResourceType.Texture, "BlackAKey", "GFX/Keys/Keyboard_Black_A"), new Resource(ResourceType.Texture, "BlackSKey", "GFX/Keys/Keyboard_Black_S"), new Resource(ResourceType.Texture, "BlackDKey", "GFX/Keys/Keyboard_Black_D"), new Resource(ResourceType.Texture, "BlackSpaceKey", "GFX/Keys/Keyboard_Black_Space"), new Resource(ResourceType.Texture, "BlackPKey", "GFX/Keys/Keyboard_Black_P"), new Resource(ResourceType.Texture, "BlackEscKey", "GFX/Keys/Keyboard_Black_Esc"), new Resource(ResourceType.Texture, "WhiteWKey", "GFX/Keys/Keyboard_White_W"), new Resource(ResourceType.Texture, "WhiteAKey", "GFX/Keys/Keyboard_White_A"), new Resource(ResourceType.Texture, "WhiteSKey", "GFX/Keys/Keyboard_White_S"), new Resource(ResourceType.Texture, "WhiteDKey", "GFX/Keys/Keyboard_White_D"), new Resource(ResourceType.Texture, "WhiteSpaceKey", "GFX/Keys/Keyboard_White_Space"), new Resource(ResourceType.Texture, "WhitePKey", "GFX/Keys/Keyboard_White_P"), new Resource(ResourceType.Texture, "WhiteEscKey", "GFX/Keys/Keyboard_White_Esc"), #endregion #region Fonts new Resource(ResourceType.Font, "StandardMenuItem", "Fonts/standardMenuItemFont"), new Resource(ResourceType.Font, "SelectedMenuItem", "Fonts/highlightedMenuItemFont"), new Resource(ResourceType.Font, "Title", "Fonts/titleFont"), new Resource(ResourceType.Font, "Score", "Fonts/scoreFont"), new Resource(ResourceType.Font, "BasicText", "Fonts/basicText"), #endregion #region Sound Effects new Resource(ResourceType.Sound, "PlayerShoot", "SFX/PlayerShoot"), new Resource(ResourceType.Sound, "EnemyShoot", "SFX/EnemyShoot"), new Resource(ResourceType.Sound, "Destroy", "SFX/Destroy"), new Resource(ResourceType.Sound, "Explosion", "SFX/Explosion2"), new Resource(ResourceType.Sound, "Shoot", "SFX/Laser_Shoot16"), #endregion #region Music new Resource(ResourceType.Music, "GameMusic", "Music/GameMusic"), new Resource(ResourceType.Music, "MenuMusic", "Music/MenuMusic"), new Resource(ResourceType.Music, "EndMusic", "Music/EndMusic"), #endregion }); /* This should probably be called in this.LoadContent() * but DrawableGameComponent.LoadContent() will be called * before this.LoadContent() meaning the resources/content wont be ready. */ ResourceManager.LoadContent(); // Add a scrolling background behind each screen Components.Add(new ScrollingBackground(this)); // Add the game screen to the game. GameScreen gameScreen = new GameScreen(this); Components.Add(gameScreen); Services.AddService(gameScreen); // Add the end screen to the game. EndScreen endScreen = new EndScreen(this); Components.Add(endScreen); Services.AddService(endScreen); // Add the credits screen to the game. CreditsScreen creditsScreen = new CreditsScreen(this); Components.Add(creditsScreen); Services.AddService(creditsScreen); // Add the help screen to the game. HelpScreen helpScreen = new HelpScreen(this); Components.Add(helpScreen); Services.AddService(helpScreen); // Add the start screen to the game. StartScreen startScreen = new StartScreen(this); Components.Add(startScreen); Services.AddService(startScreen); // Initialize all components base.Initialize(); // Hide all the screens and set the start screen to the active screen HideScreens(); startScreen.SetActive(true); startScreen.PlayMusic(); }