public override void Notify() { Ship pShip = (Ship)this.pSubject.pObjA; Bomb pBomb = (Bomb)this.pSubject.pObjB; if (pBomb.bMarkForDeath == false) { pBomb.bMarkForDeath = true; pBomb.Remove(); } Player pPlayer = pShip.pPlayer; pPlayer.nLives--; //--------------------------------------------------------------------------------------------------------- // Scene Transition //--------------------------------------------------------------------------------------------------------- if (pPlayer.nLives == 0 && pPlayer.n == 1 && PlayerMan.nPlayers == 2) { // Switch players PlayerMan.WriteHighScores(); PlayerMan.SetCurrentPlayer(2); SceneContext.GetState().Initialize(); SceneContext.SetState(SceneContext.Scene.MultiPlay); return; } else if (pPlayer.nLives == 0 && pPlayer.n == PlayerMan.nPlayers) { // Game OVER PlayerMan.WriteHighScores(); SceneContext.SetState(SceneContext.Scene.Over); return; } Font pFont = FontMan.Find(Font.Name.NumLives1); pFont.Set(Font.Name.NumLives1, pShip.pPlayer.nLives.ToString(), Glyph.Name.Consolas20pt, 15, 15); Ship pShipInactive = (Ship)GameObjectMan.Find(GameObject.Name.ShipInactive); if (pShipInactive.bMarkForDeath == false) { pShipInactive.bMarkForDeath = true; pShipInactive.RemoveInactiveShip(); } }
public override void LoadContent() { //--------------------------------------------------------------------------------------------------------- // Setup Managers - once here //--------------------------------------------------------------------------------------------------------- TimerMan.Create(3, 1); TextureMan.Create(1, 1); TextureMan.Add(Texture.Name.Aliens, "Aliens.tga"); TextureMan.Add(Texture.Name.Birds, "Birds_N_Shield.tga"); TextureMan.Add(Texture.Name.Birds2, "Birds_N_Shield.tga"); //--------------------------------------------------------------------------------------------------------- // Sounds //--------------------------------------------------------------------------------------------------------- SoundMan.Create(); SoundMan.Add(Sound.Name.Explode, "explosion.wav"); SoundMan.Add(Sound.Name.Shoot, "shoot.wav"); SoundMan.Add(Sound.Name.Invader1, "fastinvader1.wav"); SoundMan.Add(Sound.Name.Invader2, "fastinvader2.wav"); SoundMan.Add(Sound.Name.Invader3, "fastinvader3.wav"); SoundMan.Add(Sound.Name.Invader4, "fastinvader4.wav"); SoundMan.Add(Sound.Name.InvaderKilled, "invaderkilled.wav"); SoundMan.Add(Sound.Name.UFOLow, "ufo_lowpitch.wav"); SoundMan.Add(Sound.Name.UFOHigh, "ufo_highpitch.wav"); ImageMan.Create(5, 2); ImageMan.Add(Image.Name.Default, Texture.Name.Aliens, new Azul.Rect(0, 0, 0, 0)); ImageMan.Add(Image.Name.NullObject, Texture.Name.Aliens, new Azul.Rect(0, 0, 0, 0)); GameSpriteMan.Create(25, 5); BoxSpriteMan.Create(25, 5); SpriteBatchMan.Create(5, 2); ProxySpriteMan.Create(10, 1); GameObjectMan.Create(50, 5); ColPairMan.Create(25, 5); GlyphMan.Create(5, 2); FontMan.Create(5, 2); ShipMan.Create(); PlayerMan.Create(); SceneContext.Create(); }