public override void Transition() { SpriteBatchMan.SetActive(this.poSpriteBatchMan); GameObjectMan.SetActive(this.poGameObjectMan); InputMan.SetActive(this.poInputMan); TimerMan.SetActive(this.poTimerMan); }
//public override void Transition() //{ // // update SpriteBatchMan() // SpriteBatchMan.SetActive(this.poSpriteBatchMan); //} public override void Entering() { // update SpriteBatchMan() SpriteBatchMan.SetActive(this.poSpriteBatchMan); GameObjectMan.SetActive(this.poGameObjectMan); TimerMan.SetActive(this.poTimerMan); ShipMan.SetActive(this.poShipMan); DelayedObjectMan.SetActive(this.poDelayedObjectMan); // Update timer since last pause float t0 = GlobalTimer.GetTime(); float t1 = this.TimeAtPause; float delta = t0 - t1; TimerMan.PauseUpdate(delta); }
public override void Initialize() { Random pRandom = new Random(); //--------------------------------------------------------------------------------------------------------- // Images //--------------------------------------------------------------------------------------------------------- ImageMan.Add(Image.Name.BlueAlien, Texture.Name.Aliens, new Azul.Rect(341, 337, 65, 64)); ImageMan.Add(Image.Name.BlueAlien2, Texture.Name.Aliens, new Azul.Rect(464, 65, 64, 63)); ImageMan.Add(Image.Name.GreenAlien, Texture.Name.Aliens, new Azul.Rect(27, 337, 79, 64)); ImageMan.Add(Image.Name.GreenAlien2, Texture.Name.Aliens, new Azul.Rect(253, 64, 84, 65)); ImageMan.Add(Image.Name.RedAlien, Texture.Name.Aliens, new Azul.Rect(647, 200, 72, 65)); ImageMan.Add(Image.Name.RedAlien2, Texture.Name.Aliens, new Azul.Rect(26, 201, 94, 65)); ImageMan.Add(Image.Name.Explosion, Texture.Name.Aliens, new Azul.Rect(488, 488, 75, 48)); ImageMan.Add(Image.Name.Explosion_Ground, Texture.Name.Aliens, new Azul.Rect(328, 489, 84, 48)); ImageMan.Add(Image.Name.UFO, Texture.Name.Aliens, new Azul.Rect(120, 489, 98, 49)); ImageMan.Add(Image.Name.Missile, Texture.Name.Aliens, new Azul.Rect(267, 501, 9, 34)); ImageMan.Add(Image.Name.Ship, Texture.Name.Birds2, new Azul.Rect(9, 92, 31, 19)); ImageMan.Add(Image.Name.Wall, Texture.Name.Birds, new Azul.Rect(40, 185, 20, 10)); ImageMan.Add(Image.Name.WallBottom, Texture.Name.Birds, new Azul.Rect(40, 185, 20, 1)); ImageMan.Add(Image.Name.BombStraight, Texture.Name.Birds, new Azul.Rect(110, 100, 7, 49)); ImageMan.Add(Image.Name.BombZigZag, Texture.Name.Birds, new Azul.Rect(132, 100, 20, 50)); ImageMan.Add(Image.Name.BombCross, Texture.Name.Birds, new Azul.Rect(219, 103, 19, 47)); ImageMan.Add(Image.Name.Brick, Texture.Name.Birds, new Azul.Rect(20, 210, 10, 5)); ImageMan.Add(Image.Name.BrickLeft_Top0, Texture.Name.Birds, new Azul.Rect(15, 180, 10, 5)); ImageMan.Add(Image.Name.BrickLeft_Top1, Texture.Name.Birds, new Azul.Rect(15, 185, 10, 5)); ImageMan.Add(Image.Name.BrickLeft_Bottom, Texture.Name.Birds, new Azul.Rect(35, 215, 10, 5)); ImageMan.Add(Image.Name.BrickRight_Top0, Texture.Name.Birds, new Azul.Rect(75, 180, 10, 5)); ImageMan.Add(Image.Name.BrickRight_Top1, Texture.Name.Birds, new Azul.Rect(75, 185, 10, 5)); ImageMan.Add(Image.Name.BrickRight_Bottom, Texture.Name.Birds, new Azul.Rect(55, 215, 10, 5)); //--------------------------------------------------------------------------------------------------------- // Game Sprites //--------------------------------------------------------------------------------------------------------- GameSpriteMan.Add(GameSprite.Name.BlueAlien, Image.Name.BlueAlien, 100, 150, 30, 30); GameSpriteMan.Add(GameSprite.Name.RedAlien, Image.Name.RedAlien, 200, 150, 30, 30); GameSpriteMan.Add(GameSprite.Name.GreenAlien, Image.Name.GreenAlien, 300, 150, 30, 30); GameSpriteMan.Add(GameSprite.Name.UFO, Image.Name.UFO, 120, 489, 70, 25); GameSpriteMan.Add(GameSprite.Name.Explosion_Ground, Image.Name.Explosion_Ground, 328, 489, 30, 20); GameSpriteMan.Add(GameSprite.Name.Explosion, Image.Name.Explosion, 120, 489, 30, 20); GameSpriteMan.Add(GameSprite.Name.Missile, Image.Name.Missile, -100, -100, 3, 12); GameSpriteMan.Add(GameSprite.Name.Ship, Image.Name.Ship, 500, 100, 50, 20); GameSpriteMan.Add(GameSprite.Name.ShipInactive, Image.Name.Ship, 500, 100, 50, 20); GameSpriteMan.Add(GameSprite.Name.Wall, Image.Name.Wall, 448, 900, 850, 30); GameSpriteMan.Add(GameSprite.Name.WallBottom, Image.Name.WallBottom, 448, 900, 850, 1); GameSpriteMan.Add(GameSprite.Name.BombZigZag, Image.Name.BombZigZag, 200, 200, 8, 25); GameSpriteMan.Add(GameSprite.Name.BombStraight, Image.Name.BombStraight, 110, 100, 8, 25); GameSpriteMan.Add(GameSprite.Name.BombDagger, Image.Name.BombCross, 100, 100, 8, 25); GameSpriteMan.Add(GameSprite.Name.Brick, Image.Name.Brick, 50, 25, 10, 5); GameSpriteMan.Add(GameSprite.Name.Brick_LeftTop0, Image.Name.BrickLeft_Top0, 50, 25, 10, 5); GameSpriteMan.Add(GameSprite.Name.Brick_LeftTop1, Image.Name.BrickLeft_Top1, 50, 25, 10, 5); GameSpriteMan.Add(GameSprite.Name.Brick_LeftBottom, Image.Name.BrickLeft_Bottom, 50, 25, 10, 5); GameSpriteMan.Add(GameSprite.Name.Brick_RightTop0, Image.Name.BrickRight_Top0, 50, 25, 10, 5); GameSpriteMan.Add(GameSprite.Name.Brick_RightTop1, Image.Name.BrickRight_Top1, 50, 25, 10, 5); GameSpriteMan.Add(GameSprite.Name.Brick_RightBottom, Image.Name.BrickRight_Bottom, 50, 25, 10, 5); BoxSpriteMan.Add(BoxSprite.Name.Box1, 550.0f, 500.0f, 50.0f, 150.0f, new Azul.Color(1.0f, 1.0f, 1.0f, 1.0f)); BoxSpriteMan.Add(BoxSprite.Name.Box2, 550.0f, 100.0f, 50.0f, 100.0f); this.poSpriteBatchMan = new SpriteBatchMan(3, 1); SpriteBatchMan.SetActive(this.poSpriteBatchMan); this.poGameObjectMan = new GameObjectMan(10, 2); GameObjectMan.SetActive(this.poGameObjectMan); this.poInputMan = new InputMan(); InputMan.SetActive(this.poInputMan); this.poTimerMan = new TimerMan(); TimerMan.SetActive(this.poTimerMan); //--------------------------------------------------------------------------------------------------------- // SpriteBatches //--------------------------------------------------------------------------------------------------------- SpriteBatch pSB_Box = SpriteBatchMan.Add(SpriteBatch.Name.Boxes, 100, false); SpriteBatch pSB_Texts = SpriteBatchMan.Add(SpriteBatch.Name.Texts, 100, true); SpriteBatch pSB_Shields = SpriteBatchMan.Add(SpriteBatch.Name.Shields, 100, true); SpriteBatch pSB_Aliens = SpriteBatchMan.Add(SpriteBatch.Name.Aliens, 100, true); SpriteBatch pSB_Bombs = SpriteBatchMan.Add(SpriteBatch.Name.Bombs, 100, true); //--------------------------------------------------------------------------------------------------------- // Ship //--------------------------------------------------------------------------------------------------------- ShipRoot pShipRoot = new ShipRoot(GameObject.Name.ShipRoot, GameSprite.Name.NullObject, 0.0f, 0.0f); GameObjectMan.Attach(pShipRoot); Ship pShip = ShipMan.CreateShip(); //--------------------------------------------------------------------------------------------------------- // Player //--------------------------------------------------------------------------------------------------------- Player pPlayer = PlayerMan.GetCurrentPlayer(pShip); pShip.SetPlayer(pPlayer); //--------------------------------------------------------------------------------------------------------- // Aliens //--------------------------------------------------------------------------------------------------------- AlienFactory aF = new AlienFactory(SpriteBatch.Name.Aliens, SpriteBatch.Name.Boxes); // Do this somewhere else .. int yPos = 475; if (pPlayer.nCurrLevel == 2) { yPos -= 40; } AlienGrid pGrid = aF.CreateGrid(200, yPos); float pGridDelta = 0.2f; if (pPlayer.nCurrLevel == 2) { pGridDelta = 0.3f; } //--------------------------------------------------------------------------------------------------------- // Missile //--------------------------------------------------------------------------------------------------------- MissileGroup pMissileGroup = new MissileGroup(GameObject.Name.MissileGroup, GameSprite.Name.NullObject, 0.0f, 0.0f); pMissileGroup.ActivateGameSprite(pSB_Aliens); GameObjectMan.Attach(pMissileGroup); //--------------------------------------------------------------------------------------------------------- // Bomb //--------------------------------------------------------------------------------------------------------- BombRoot pBombRoot = new BombRoot(GameObject.Name.BombRoot, GameSprite.Name.NullObject, 0.0f, 0.0f); pBombRoot.ActivateCollisionSprite(pSB_Box); pBombRoot.ActivateGameSprite(pSB_Bombs); GameObjectMan.Attach(pBombRoot); //--------------------------------------------------------------------------------------------------------- // Input //--------------------------------------------------------------------------------------------------------- InputSubject pInputSubject; pInputSubject = InputMan.GetArrowRightSubject(); pInputSubject.Attach(new MoveRightObserver(pShip)); pInputSubject = InputMan.GetArrowLeftSubject(); pInputSubject.Attach(new MoveLeftObserver(pShip)); pInputSubject = InputMan.GetSpaceSubject(); pInputSubject.Attach(new ShootObserver(pShip)); pInputSubject = InputMan.GetPeriodSubject(); pInputSubject.Attach(new ToggleRenderBoxSpriteObserver()); pInputSubject = InputMan.GetCommaSubject(); pInputSubject.Attach(new ToggleShieldBricksObserver()); //--------------------------------------------------------------------------------------------------------- // Walls //--------------------------------------------------------------------------------------------------------- WallGroup pWallGroup = new WallGroup(GameObject.Name.WallGroup, GameSprite.Name.NullObject, 0.0f, 0.0f); pWallGroup.ActivateGameSprite(pSB_Aliens); WallTop pWallTop = new WallTop(GameObject.Name.WallTop, GameSprite.Name.Wall, 400, 750, 700, 15); pWallTop.ActivateCollisionSprite(pSB_Aliens); WallBottom pWallBottom = new WallBottom(GameObject.Name.WallBottom, GameSprite.Name.WallBottom, 400, 30, 850, 1); pWallBottom.ActivateCollisionSprite(pSB_Box); pWallBottom.ActivateGameSprite(pSB_Aliens); WallLeft pWallLeft = new WallLeft(GameObject.Name.WallLeft, GameSprite.Name.Wall, 0, 300, 15, 600); pWallLeft.ActivateCollisionSprite(pSB_Box); WallRight pWallRight = new WallRight(GameObject.Name.WallRight, GameSprite.Name.Wall, 800, 300, 15, 600); pWallRight.ActivateCollisionSprite(pSB_Box); pWallGroup.Add(pWallTop); pWallGroup.Add(pWallBottom); pWallGroup.Add(pWallRight); pWallGroup.Add(pWallLeft); GameObjectMan.Attach(pWallGroup); //--------------------------------------------------------------------------------------------------------- // Shield //--------------------------------------------------------------------------------------------------------- ShieldFactory SF = new ShieldFactory(SpriteBatch.Name.Shields, SpriteBatch.Name.Boxes, GameObject.Name.ShieldRoot1); Composite pShieldRoot1 = SF.CreateShield(50.0f, 100.0f); GameObjectMan.Attach(pShieldRoot1); SF = new ShieldFactory(SpriteBatch.Name.Shields, SpriteBatch.Name.Boxes, GameObject.Name.ShieldRoot2); Composite pShieldRoot2 = SF.CreateShield(200.0f, 100.0f); GameObjectMan.Attach(pShieldRoot2); SF = new ShieldFactory(SpriteBatch.Name.Shields, SpriteBatch.Name.Boxes, GameObject.Name.ShieldRoot3); Composite pShieldRoot3 = SF.CreateShield(500.0f, 100.0f); GameObjectMan.Attach(pShieldRoot3); SF = new ShieldFactory(SpriteBatch.Name.Shields, SpriteBatch.Name.Boxes, GameObject.Name.ShieldRoot4); Composite pShieldRoot4 = SF.CreateShield(650.0f, 100.0f); GameObjectMan.Attach(pShieldRoot4); //--------------------------------------------------------------------------------------------------------- // Collision Observers //--------------------------------------------------------------------------------------------------------- ColPair pColPair; // Missile vs Wall pColPair = ColPairMan.Add(ColPair.Name.Missile_Wall, pMissileGroup, pWallGroup); pColPair.Attach(new RemoveMissileObserver()); pColPair.Attach(new ShipReadyObserver(pShip)); // Bomb vs Bottom pColPair = ColPairMan.Add(ColPair.Name.Bomb_Wall, pBombRoot, pWallGroup); pColPair.Attach(new RemoveBombObserver()); // Bomb vs Missile pColPair = ColPairMan.Add(ColPair.Name.Bomb_Missile, pBombRoot, pMissileGroup); pColPair.Attach(new RemoveMissileAndBombObserver()); pColPair.Attach(new ShipReadyObserver(pShip)); // Bomb vs Shields pColPair = ColPairMan.Add(ColPair.Name.Bomb_Shield1, pBombRoot, pShieldRoot1); pColPair.Attach(new RemoveBombObserver()); pColPair.Attach(new RemoveBrickObserver()); pColPair = ColPairMan.Add(ColPair.Name.Bomb_Shield2, pBombRoot, pShieldRoot2); pColPair.Attach(new RemoveBombObserver()); pColPair.Attach(new RemoveBrickObserver()); pColPair = ColPairMan.Add(ColPair.Name.Bomb_Shield3, pBombRoot, pShieldRoot3); pColPair.Attach(new RemoveBombObserver()); pColPair.Attach(new RemoveBrickObserver()); pColPair = ColPairMan.Add(ColPair.Name.Bomb_Shield4, pBombRoot, pShieldRoot4); pColPair.Attach(new RemoveBombObserver()); pColPair.Attach(new RemoveBrickObserver()); // Missile vs Shields pColPair = ColPairMan.Add(ColPair.Name.Missile_Shield1, pMissileGroup, pShieldRoot1); pColPair.Attach(new RemoveMissileObserver()); pColPair.Attach(new RemoveBrickObserver()); pColPair.Attach(new ShipReadyObserver(pShip)); pColPair = ColPairMan.Add(ColPair.Name.Missile_Shield2, pMissileGroup, pShieldRoot2); pColPair.Attach(new RemoveMissileObserver()); pColPair.Attach(new RemoveBrickObserver()); pColPair.Attach(new ShipReadyObserver(pShip)); pColPair = ColPairMan.Add(ColPair.Name.Missile_Shield3, pMissileGroup, pShieldRoot3); pColPair.Attach(new RemoveMissileObserver()); pColPair.Attach(new RemoveBrickObserver()); pColPair.Attach(new ShipReadyObserver(pShip)); pColPair = ColPairMan.Add(ColPair.Name.Missile_Shield4, pMissileGroup, pShieldRoot4); pColPair.Attach(new RemoveMissileObserver()); pColPair.Attach(new RemoveBrickObserver()); pColPair.Attach(new ShipReadyObserver(pShip)); // Alien Grid vs Shields pColPair = ColPairMan.Add(ColPair.Name.AlienGrid_Shield1, pGrid, pShieldRoot1); pColPair.Attach(new RemoveBrickObserver()); pColPair = ColPairMan.Add(ColPair.Name.AlienGrid_Shield2, pGrid, pShieldRoot2); pColPair.Attach(new RemoveBrickObserver()); pColPair = ColPairMan.Add(ColPair.Name.AlienGrid_Shield3, pGrid, pShieldRoot3); pColPair.Attach(new RemoveBrickObserver()); pColPair = ColPairMan.Add(ColPair.Name.AlienGrid_Shield4, pGrid, pShieldRoot4); pColPair.Attach(new RemoveBrickObserver()); // Missile vs Alien pColPair = ColPairMan.Add(ColPair.Name.Alien_Missile, pMissileGroup, pGrid); pColPair.Attach(new RemoveMissileObserver()); pColPair.Attach(new RemoveAlienObserver()); pColPair.Attach(new ShipReadyObserver(pShip)); // Alien Grid vs WallLeft pColPair = ColPairMan.Add(ColPair.Name.AlienGrid_WallLeft, pGrid, pWallLeft); pColPair.Attach(new AlienGridWallLeftObserver(pGridDelta)); // Alien Grid vs WallRight pColPair = ColPairMan.Add(ColPair.Name.AlienGrid_WallRight, pGrid, pWallRight); pColPair.Attach(new AlienGridWallRightObserver(pGridDelta)); // Alien Grid vs WallBottom pColPair = ColPairMan.Add(ColPair.Name.AlienGrid_WallBottom, pGrid, pWallBottom); pColPair.Attach(new AlienGridWallBottomObserver()); // Ship vs Bomb pColPair = ColPairMan.Add(ColPair.Name.ShipBomb, pShipRoot, pBombRoot); pColPair.Attach(new BombObserver()); //--------------------------------------------------------------------------------------------------------- // Alien Animations //--------------------------------------------------------------------------------------------------------- RedAlienAnimationCommand pRedAlienAnimation = new RedAlienAnimationCommand(GameSprite.Name.RedAlien); pRedAlienAnimation.Attach(Image.Name.RedAlien); pRedAlienAnimation.Attach(Image.Name.RedAlien2); TimerMan.Add(TimeEvent.Name.RedAlienAnimation, pRedAlienAnimation, 1.0f); BlueAlienAnimationCommand pBlueAlienAnimation = new BlueAlienAnimationCommand(GameSprite.Name.BlueAlien); pBlueAlienAnimation.Attach(Image.Name.BlueAlien); pBlueAlienAnimation.Attach(Image.Name.BlueAlien2); TimerMan.Add(TimeEvent.Name.BlueAlienAnimation, pBlueAlienAnimation, 1.0f); GreenAlienAnimationCommand pGreenAlienAnimation = new GreenAlienAnimationCommand(GameSprite.Name.GreenAlien); pGreenAlienAnimation.Attach(Image.Name.GreenAlien); pGreenAlienAnimation.Attach(Image.Name.GreenAlien2); TimerMan.Add(TimeEvent.Name.GreenAlienAnimation, pGreenAlienAnimation, 1.0f); //--------------------------------------------------------------------------------------------------------- // Alien Bomb Spawns //--------------------------------------------------------------------------------------------------------- BombSpawnEvent pBombSpawn = new BombSpawnEvent(pPlayer.nCurrLevel, pRandom); TimerMan.Add(TimeEvent.Name.BombSpawn, pBombSpawn, pRandom.Next(1, 10)); //--------------------------------------------------------------------------------------------------------- // Scene Play Sound //--------------------------------------------------------------------------------------------------------- ScenePlaySoundCommand pScenePlaySound = new ScenePlaySoundCommand(); pScenePlaySound.Attach(Sound.Name.Invader1); pScenePlaySound.Attach(Sound.Name.Invader2); pScenePlaySound.Attach(Sound.Name.Invader3); pScenePlaySound.Attach(Sound.Name.Invader4); TimerMan.Add(TimeEvent.Name.ScenePlaySound, pScenePlaySound, 1.5f); //--------------------------------------------------------------------------------------------------------- // UFO //--------------------------------------------------------------------------------------------------------- float value = pRandom.Next(10, 60); SpawnUFOCommand pUFO = new SpawnUFOCommand(pRandom, pWallLeft, pWallRight); TimerMan.Add(TimeEvent.Name.UFO, pUFO, value); //--------------------------------------------------------------------------------------------------------- // Texts //--------------------------------------------------------------------------------------------------------- Texture pTexture = TextureMan.Add(Texture.Name.Consolas36pt, "Consolas20pt.tga"); GlyphMan.AddXml(Glyph.Name.Consolas20pt, "Consolas20pt.xml", Texture.Name.Consolas20pt); Font pFont = FontMan.Add(Font.Name.Credits00, SpriteBatch.Name.Texts, "CREDIT 00", Glyph.Name.Consolas20pt, 700, 15); pFont.SetColor(1.0f, 1.0f, 1.0f); pFont = FontMan.Add(Font.Name.Score1, SpriteBatch.Name.Texts, "SCORE <1>", Glyph.Name.Consolas20pt, 150, 585); pFont.SetColor(1.0f, 1.0f, 1.0f); Player pPlayer1 = PlayerMan.GetPlayer(1); string pPlayer1Score; if (pPlayer1 != null) { pPlayer1Score = pPlayer1.nPoints.ToString(); } else { pPlayer1Score = "0"; } pFont = FontMan.Add(Font.Name.Score1Value, SpriteBatch.Name.Texts, pPlayer1Score, Glyph.Name.Consolas20pt, 150, 550); pFont.SetColor(1.0f, 1.0f, 1.0f); pFont = FontMan.Add(Font.Name.HighScore, SpriteBatch.Name.Texts, "HIGH SCORE", Glyph.Name.Consolas20pt, 400, 585); pFont.SetColor(1.0f, 1.0f, 1.0f); HighScore hS = new HighScore(); pFont = FontMan.Add(Font.Name.HighScores, SpriteBatch.Name.Texts, hS.GetScore().ToString(), Glyph.Name.Consolas20pt, 400, 550); pFont.SetColor(1.0f, 1.0f, 1.0f); pFont = FontMan.Add(Font.Name.Score2, SpriteBatch.Name.Texts, "SCORE <2>", Glyph.Name.Consolas20pt, 650, 585); pFont.SetColor(1.0f, 1.0f, 1.0f); Player pPlayer2 = PlayerMan.GetPlayer(2); string pPlayer2Score; if (pPlayer2 != null) { pPlayer2Score = pPlayer2.nPoints.ToString(); } else { pPlayer2Score = "0"; } pFont = FontMan.Add(Font.Name.Score2Value, SpriteBatch.Name.Texts, pPlayer2Score, Glyph.Name.Consolas20pt, 650, 550); pFont.SetColor(1.0f, 1.0f, 1.0f); // Life Totals pFont = FontMan.Add(Font.Name.NumLives1, SpriteBatch.Name.Texts, pPlayer.nLives.ToString(), Glyph.Name.Consolas20pt, 15, 15); pFont.SetColor(1.0f, 1.0f, 1.0f); pShip = ShipMan.CreateInactiveShip(75, 15); pShip = ShipMan.CreateInactiveShip(150, 15); }
//i definitely think the insert() needs to be cleaned up // i had alot of reference issues private static void Insert(TimeEvent pTEnode) { Debug.Assert(pTEnode != null); TimerMan pTMan = TimerMan.PrivGetInstance(); Debug.Assert(pTMan != null); TimeEvent pEvent = (TimeEvent)pTMan.BaseGetActive(); TimeEvent pNextEvent = null; TimeEvent pPrevEvent = null; //very first node if (pEvent == null) { pTEnode.pPrev = null; pTEnode.pNext = null; DLink pTemp = (DLink)pTEnode; pEvent = (TimeEvent)pTMan.SetActive(ref pTemp); } //insert before the first node if (pTEnode.trigger < pEvent.trigger) { pTEnode.pNext = pEvent; pEvent.pPrev = pTEnode; pTEnode.pPrev = null; DLink pTemp = (DLink)pTEnode; pEvent = (TimeEvent)pTMan.SetActive(ref pTemp); } while (pTEnode.trigger >= pEvent.trigger && pTEnode.GetHashCode() != pEvent.GetHashCode()) { pNextEvent = (TimeEvent)pEvent.pNext; //then something is there if (pNextEvent != null) { //insert into middle of list if (pTEnode.trigger <= pNextEvent.trigger) { pPrevEvent = (TimeEvent)pEvent; pTEnode.pNext = pNextEvent; pTEnode.pPrev = pPrevEvent; pPrevEvent.pNext = pTEnode; pNextEvent.pPrev = pTEnode; break; } } //insert at the end of the list else { pTEnode.pPrev = pEvent; pEvent.pNext = pTEnode; pTEnode.pNext = null; break; } pEvent = pNextEvent; } }
public override void Initialize() { //this.name = SceneContext.Scene.Play; this.numLives = 3; this.isDead = false; //--------------------------------------------------------------------------------------------------------- // Unique Managers //--------------------------------------------------------------------------------------------------------- this.poSpriteBatchMan = new SpriteBatchMan(3, 1); SpriteBatchMan.SetActive(this.poSpriteBatchMan); this.poGameObjectMan = new GameObjectMan(3, 1); GameObjectMan.SetActive(this.poGameObjectMan); this.poTimerMan = new TimerMan(3, 1); TimerMan.SetActive(this.poTimerMan); this.poDelayedObjectMan = new DelayedObjectMan(); DelayedObjectMan.SetActive(this.poDelayedObjectMan); //--------------------------------------------------------------------------------------------------------- // Initialize Input Keys //--------------------------------------------------------------------------------------------------------- this.poInputMan = new InputMan(); InputMan.SetActive(this.poInputMan); InputSubject pInputSubject; pInputSubject = InputMan.GetArrowRightSubject(); pInputSubject.Attach(new MoveRightObserver()); pInputSubject = InputMan.GetArrowLeftSubject(); pInputSubject.Attach(new MoveLeftObserver()); pInputSubject = InputMan.GetSpaceSubject(); pInputSubject.Attach(new ShootObserver()); pInputSubject = InputMan.GetKey_B_Subject(); pInputSubject.Attach(new Key_B_Observer()); pInputSubject = InputMan.GetKey_1_Subject(); pInputSubject.Attach(new Key_1_Observer()); pInputSubject = InputMan.GetKey_2_Subject(); pInputSubject.Attach(new Key_2_Observer()); pInputSubject = InputMan.GetKey_Q_Subject(); pInputSubject.Attach(new Key_Q_Observer()); //--------------------------------------------------------------------------------------------------------- // Sound //--------------------------------------------------------------------------------------------------------- // start up the engine SoundEngineMan.Add(SoundEngine.Name.AlienA, "fastinvader1.wav", 0.2f); SoundEngineMan.Add(SoundEngine.Name.AlienB, "fastinvader2.wav", 0.2f); SoundEngineMan.Add(SoundEngine.Name.AlienC, "fastinvader3.wav", 0.2f); SoundEngineMan.Add(SoundEngine.Name.AlienD, "fastinvader4.wav", 0.2f); SoundEngineMan.Add(SoundEngine.Name.Shoot, "shoot.wav", 0.2f); SoundEngineMan.Add(SoundEngine.Name.Invaderkilled, "invaderkilled.wav", 0.2f); SoundEngineMan.Add(SoundEngine.Name.Explosion, "explosion.wav", 0.2f); SoundEngineMan.Add(SoundEngine.Name.UFO_HighPitch, "ufo_highpitch.wav", 0.5f); SoundEngineMan.Add(SoundEngine.Name.UFO_LowPitch, "ufo_lowpitch.wav", 0.2f); //--------------------------------------------------------------------------------------------------------- // Font //--------------------------------------------------------------------------------------------------------- Texture pTexture = TextureMan.Add(Texture.Name.Consolas36pt, "Consolas36pt.tga"); GlyphMan.AddXml(Glyph.Name.Consolas36pt, "Consolas36pt.xml", Texture.Name.Consolas36pt); //--------------------------------------------------------------------------------------------------------- // Create Sprites //--------------------------------------------------------------------------------------------------------- this.poGameSpriteMan = new GameSpriteMan(3, 1); GameSpriteMan.SetActive(this.poGameSpriteMan); // ----- Aliens ----- GameSpriteMan.Add(GameSprite.Name.SquidOpen, Image.Name.SquidOpen, 50, 550, 22, 22); GameSpriteMan.Add(GameSprite.Name.CrabOpen, Image.Name.CrabOpen, 50, 510, 25, 25); GameSpriteMan.Add(GameSprite.Name.OctopusOpen, Image.Name.OctopusOpen, 50, 430, 28, 28); // ----- UFO ----- GameSpriteMan.Add(GameSprite.Name.UFO, Image.Name.UFO, 0, 500, 40, 18); // ----- Missile ----- GameSpriteMan.Add(GameSprite.Name.Missile, Image.Name.Missile, 50, 430, 4, 15); // ----- Ship ----- GameSpriteMan.Add(GameSprite.Name.Ship, Image.Name.Ship, 50, 430, 50, 25); // ----- Splats ----- GameSpriteMan.Add(GameSprite.Name.SplatAlien, Image.Name.AlienSplat, 100, 100, 22, 22); GameSpriteMan.Add(GameSprite.Name.SplatBomb, Image.Name.BombSplat, 100, 100, 7, 17); GameSpriteMan.Add(GameSprite.Name.SplatMissile, Image.Name.MissleSplat, 100, 100, 20, 15); GameSpriteMan.Add(GameSprite.Name.SplatUFO, Image.Name.UFOSplat, 100, 100, 40, 18); GameSpriteMan.Add(GameSprite.Name.SplatShip, Image.Name.ShipSplat, 100, 100, 50, 25); // ----- Bombs ----- GameSpriteMan.Add(GameSprite.Name.BombDragger, Image.Name.BombDragger, 100, 100, 7, 17); GameSpriteMan.Add(GameSprite.Name.BombZigZag, Image.Name.BombZigZag, 100, 100, 7, 17); GameSpriteMan.Add(GameSprite.Name.BombRolling, Image.Name.BombRolling, 100, 100, 7, 17); GameSpriteMan.Add(GameSprite.Name.BombStraight, Image.Name.BombStraight, 100, 100, 5, 17); // ----- Shields ----- float brick_W = 15.0f; float brick_H = 6.0f; GameSpriteMan.Add(GameSprite.Name.Brick, Image.Name.Brick, 50, 25, brick_W, brick_H); GameSpriteMan.Add(GameSprite.Name.Brick_LeftTop0, Image.Name.BrickLeft_Top0, 50, 25, brick_W, brick_H); GameSpriteMan.Add(GameSprite.Name.Brick_LeftTop1, Image.Name.BrickLeft_Top1, 50, 25, brick_W, brick_H); GameSpriteMan.Add(GameSprite.Name.Brick_LeftBottom, Image.Name.BrickLeft_Bottom, 50, 25, brick_W, brick_H); GameSpriteMan.Add(GameSprite.Name.Brick_RightTop0, Image.Name.BrickRight_Top0, 50, 25, brick_W, brick_H); GameSpriteMan.Add(GameSprite.Name.Brick_RightTop1, Image.Name.BrickRight_Top1, 50, 25, brick_W, brick_H); GameSpriteMan.Add(GameSprite.Name.Brick_RightBottom, Image.Name.BrickRight_Bottom, 50, 25, brick_W, brick_H); //--------------------------------------------------------------------------------------------------------- // Create SpriteBatch //--------------------------------------------------------------------------------------------------------- SpriteBatch pSB_Aliens = this.poSpriteBatchMan.Add(SpriteBatch.Name.Aliens, 100); SpriteBatch pSB_Shields = this.poSpriteBatchMan.Add(SpriteBatch.Name.Shields, 200); SpriteBatch pSB_Texts = this.poSpriteBatchMan.Add(SpriteBatch.Name.Texts, 300); SpriteBatch pSB_Box = this.poSpriteBatchMan.Add(SpriteBatch.Name.Boxes, 400); //--------------------------------------------------------------------------------------------------------- // Create Aliens //--------------------------------------------------------------------------------------------------------- // Create the Aliens factory AlienFactory AF = new AlienFactory(SpriteBatch.Name.Aliens, SpriteBatch.Name.Boxes); // Initialize Grid AlienGrid pGrid = (AlienGrid)AF.Create(GameObject.Name.AlienGrid, AlienCategory.Type.Grid); // Generate Aliens pGrid.GenerateAlien(this.poGameObjectMan); MoveCommand pMoveGrid = new MoveCommand(pGrid); TimerMan.Add(TimeEvent.Name.MoveGrid, pMoveGrid, 0.5f); //--------------------------------------------------------------------------------------------------------- // Timer //--------------------------------------------------------------------------------------------------------- // Create animation for Squid sprite AnimationSprite pAnimSquid = new AnimationSprite(GameSprite.Name.SquidOpen); // Attach Squid images to cycle pAnimSquid.Attach(Image.Name.SquidOpen); pAnimSquid.Attach(Image.Name.SquidClosed); // Create animation for Crab sprite AnimationSprite pAnimCrab = new AnimationSprite(GameSprite.Name.CrabOpen); // Attach Crab images to cycle pAnimCrab.Attach(Image.Name.CrabOpen); pAnimCrab.Attach(Image.Name.CrabClosed); // Create animation for Octopus sprite AnimationSprite pAnimOctopus = new AnimationSprite(GameSprite.Name.OctopusOpen); // Attach Octopus images to cycle pAnimOctopus.Attach(Image.Name.OctopusOpen); pAnimOctopus.Attach(Image.Name.OctopusClosed); // Add AnimationSprite to timer TimerMan.Add(TimeEvent.Name.SwapAliens, pAnimSquid, 0.5f); TimerMan.Add(TimeEvent.Name.SwapAliens, pAnimCrab, 0.5f); TimerMan.Add(TimeEvent.Name.SwapAliens, pAnimOctopus, 0.5f); // Add Grid Tempo GridSoundTempoEvent pGridTempo = new GridSoundTempoEvent(); pGridTempo.Attach(SoundEngine.Name.AlienA); pGridTempo.Attach(SoundEngine.Name.AlienB); pGridTempo.Attach(SoundEngine.Name.AlienC); pGridTempo.Attach(SoundEngine.Name.AlienD); TimerMan.Add(TimeEvent.Name.GridSoundTempo, pGridTempo, 0.5f); //--------------------------------------------------------------------------------------------------------- // Create Missile //--------------------------------------------------------------------------------------------------------- // Missile Root MissileGroup pMissileGroup = new MissileGroup(GameObject.Name.MissileGroup, GameSprite.Name.NullObject, 0.0f, 0.0f); pMissileGroup.ActivateGameSprite(pSB_Aliens); pMissileGroup.ActivateCollisionSprite(pSB_Box); GameObjectMan.Attach(pMissileGroup); //--------------------------------------------------------------------------------------------------------- // Splat Root //--------------------------------------------------------------------------------------------------------- BombRoot pSplatRoot = new BombRoot(GameObject.Name.SplatRoot, GameSprite.Name.NullObject, 0.0f, 0.0f); pSplatRoot.ActivateCollisionSprite(pSB_Box); GameObjectMan.Attach(pSplatRoot); //--------------------------------------------------------------------------------------------------------- // Bomb Root //--------------------------------------------------------------------------------------------------------- BombRoot pBombRoot = new BombRoot(GameObject.Name.BombRoot, GameSprite.Name.NullObject, 0.0f, 0.0f); pBombRoot.ActivateCollisionSprite(pSB_Box); GameObjectMan.Attach(pBombRoot); TimerMan.Add(TimeEvent.Name.BombRandom, new BombSpawnEvent(pRandom, pGrid), 1.0f); //--------------------------------------------------------------------------------------------------------- // Create Walls //--------------------------------------------------------------------------------------------------------- // Wall Root WallGroup pWallGroup = new WallGroup(GameObject.Name.WallGroup, GameSprite.Name.NullObject, 0.0f, 0.0f); pWallGroup.ActivateGameSprite(pSB_Aliens); pWallGroup.ActivateCollisionSprite(pSB_Box); WallRight pWallRight = new WallRight(GameObject.Name.WallRight, GameSprite.Name.NullObject, 775, 290, 20, 500); pWallRight.ActivateCollisionSprite(pSB_Box); WallLeft pWallLeft = new WallLeft(GameObject.Name.WallLeft, GameSprite.Name.NullObject, 25, 290, 20, 500); pWallLeft.ActivateCollisionSprite(pSB_Box); // Add to the composite the children pWallGroup.Add(pWallRight); pWallGroup.Add(pWallLeft); GameObjectMan.Attach(pWallGroup); //--------------------------------------------------------------------------------------------------------- // Create No Score Items //--------------------------------------------------------------------------------------------------------- WallGroup pNoScoreGroup = new WallGroup(GameObject.Name.NoScoreGroup, GameSprite.Name.NullObject, 0.0f, 0.0f); pNoScoreGroup.ActivateGameSprite(pSB_Aliens); pNoScoreGroup.ActivateCollisionSprite(pSB_Box); WallTop pWallTop = new WallTop(GameObject.Name.WallTop, GameSprite.Name.NullObject, 400, 540, 700, 0); pWallTop.ActivateCollisionSprite(pSB_Aliens); WallBottom pWallBottom = new WallBottom(GameObject.Name.WallBottom, GameSprite.Name.NullObject, 400, 40, 730, 0); pWallBottom.ActivateGameSprite(pSB_Aliens); pWallBottom.ActivateCollisionSprite(pSB_Box); pNoScoreGroup.Add(pWallTop); pNoScoreGroup.Add(pWallBottom); GameObjectMan.Attach(pNoScoreGroup); //--------------------------------------------------------------------------------------------------------- // Ship //--------------------------------------------------------------------------------------------------------- ShipRoot pShipRoot = new ShipRoot(GameObject.Name.ShipRoot, GameSprite.Name.NullObject, 0.0f, 0.0f); pShipRoot.ActivateGameSprite(pSB_Aliens); pShipRoot.ActivateCollisionSprite(pSB_Box); GameObjectMan.Attach(pShipRoot); //ShipMan.Create(); this.poShipMan = new ShipMan(); ShipMan.SetActive(this.poShipMan); this.poShipMan.pShip = ShipMan.ActivateShip(); this.poShipMan.pShip.SetState(ShipMan.State.Ready); //--------------------------------------------------------------------------------------------------------- // UFO //--------------------------------------------------------------------------------------------------------- UFORoot pUFORoot = new UFORoot(GameObject.Name.UFORoot, GameSprite.Name.NullObject, 0.0f, 0.0f); pUFORoot.ActivateGameSprite(pSB_Aliens); pUFORoot.ActivateCollisionSprite(pSB_Box); GameObjectMan.Attach(pUFORoot); TimerMan.Add(TimeEvent.Name.UFORandom, new UFOSpawnEvent(pRandom), 5.0f); //--------------------------------------------------------------------------------------------------------- // Shields //--------------------------------------------------------------------------------------------------------- Composite pShieldRoot = ShieldsGroupFactory.Create(100, 130, this.poGameObjectMan); //--------------------------------------------------------------------------------------------------------- // ColPair //--------------------------------------------------------------------------------------------------------- // Grid vs Right Left Walls ColPair pColPair_GW = ColPairMan.Add(ColPair.Name.Alien_Wall, pGrid, pWallGroup); Debug.Assert(pColPair_GW != null); pColPair_GW.Attach(new GridDropObserver()); // Ship vs Right Left Walls ColPair pColPair_SW = ColPairMan.Add(ColPair.Name.Ship_Wall, pShipRoot, pWallGroup); Debug.Assert(pColPair_SW != null); pColPair_SW.Attach(new StopShipMoveObserver()); // Grid vs Shield ColPair pColPair_AS = ColPairMan.Add(ColPair.Name.Bomb_Shield, pGrid, pShieldRoot); Debug.Assert(pColPair_AS != null); pColPair_AS.Attach(new RemoveBrickObserver()); // Missile vs Alien ColPair pColPair_MA = ColPairMan.Add(ColPair.Name.Missile_Alien, pMissileGroup, pGrid); Debug.Assert(pColPair_MA != null); pColPair_MA.Attach(new ShipReadyObserver()); pColPair_MA.Attach(new RemoveAlienObserver(this)); pColPair_MA.Attach(new ShipRemoveMissileObserver(false)); pColPair_MA.Attach(new SndAlienHitObserver()); pColPair_MA.Attach(new SpeedGridObserver()); // Missile vs UFO ColPair pColPair_MU = ColPairMan.Add(ColPair.Name.Missile_UFO, pMissileGroup, pUFORoot); Debug.Assert(pColPair_MU != null); pColPair_MU.Attach(new ShipReadyObserver()); pColPair_MU.Attach(new ShipRemoveMissileObserver(false)); pColPair_MU.Attach(new RemoveUFOObserver()); pColPair_MU.Attach(new SndAlienHitObserver()); // Missle vs Bomb ColPair pColPair_MB = ColPairMan.Add(ColPair.Name.Missile_Bomb, pMissileGroup, pBombRoot); Debug.Assert(pColPair_MB != null); pColPair_MB.Attach(new ShipReadyObserver()); pColPair_MB.Attach(new ShipRemoveMissileObserver(false)); pColPair_MB.Attach(new BombObserver(true)); // Missile vs Top Wall ColPair pColPair_MW = ColPairMan.Add(ColPair.Name.Missile_Wall, pMissileGroup, pNoScoreGroup); Debug.Assert(pColPair_MW != null); pColPair_MW.Attach(new ShipReadyObserver()); pColPair_MW.Attach(new ShipRemoveMissileObserver(true)); // Missile vs Shield ColPair pColPair_MS = ColPairMan.Add(ColPair.Name.Misslie_Shield, pMissileGroup, pShieldRoot); Debug.Assert(pColPair_MS != null); pColPair_MS.Attach(new ShipRemoveMissileObserver(false)); pColPair_MS.Attach(new RemoveBrickObserver()); pColPair_MS.Attach(new ShipReadyObserver()); pColPair_MS.Attach(new SndAlienHitObserver()); // Bomb vs Bottom Wall ColPair pColPair_BW = ColPairMan.Add(ColPair.Name.Bomb_Wall, pBombRoot, pNoScoreGroup); Debug.Assert(pColPair_BW != null); pColPair_BW.Attach(new BombObserver(true)); // Bomb vs Shield ColPair pColPair_BS = ColPairMan.Add(ColPair.Name.Bomb_Shield, pBombRoot, pShieldRoot); Debug.Assert(pColPair_BS != null); pColPair_BS.Attach(new RemoveBombObserver(this)); pColPair_BS.Attach(new RemoveBrickObserver()); pColPair_BS.Attach(new SndAlienHitObserver()); // Bomb vs Player's Ship ColPair pColPair_BP = ColPairMan.Add(ColPair.Name.Bomb_Ship, pBombRoot, pShipRoot); Debug.Assert(pColPair_BP != null); pColPair_BP.Attach(new RemoveShipObserver(this)); pColPair_BP.Attach(new RemoveBombObserver(this)); pColPair_BP.Attach(new SndShipHitObserver()); pColPair_BP.Attach(new ReCreateShipObserver(this)); //--------------------------------------------------------------------------------------------------------- // Fonts //--------------------------------------------------------------------------------------------------------- FontMan.Add(Font.Name.ScoreText, SpriteBatch.Name.Texts, "SCORE<1>", Glyph.Name.Consolas36pt, 60, 585); pFontScore1 = FontMan.Add(Font.Name.Score1, SpriteBatch.Name.Texts, "0000", Glyph.Name.Consolas36pt, 85, 558); FontMan.Add(Font.Name.ScoreText, SpriteBatch.Name.Texts, "HI-SCORE", Glyph.Name.Consolas36pt, 325, 585); pFontHighScore = FontMan.Add(Font.Name.HighScore, SpriteBatch.Name.Texts, "0000", Glyph.Name.Consolas36pt, 350, 558); FontMan.Add(Font.Name.ScoreText, SpriteBatch.Name.Texts, "SCORE<2>", Glyph.Name.Consolas36pt, 600, 585); pFontScore2 = FontMan.Add(Font.Name.Score2, SpriteBatch.Name.Texts, "0000", Glyph.Name.Consolas36pt, 625, 558); FontMan.Add(Font.Name.ScoreText, SpriteBatch.Name.Texts, "LIVES: ", Glyph.Name.Consolas36pt, 50, 25); pFontLives = FontMan.Add(Font.Name.Lives, SpriteBatch.Name.Texts, "3", Glyph.Name.Consolas36pt, 160, 25); }
public override void Initialize() { ImageMan.Add(Image.Name.Logo, Texture.Name.Aliens, new Azul.Rect(24, 78, 85, 40)); GameSpriteMan.Add(GameSprite.Name.Logo, Image.Name.Logo, 200, 350, 180, 90); this.poSpriteBatchMan = new SpriteBatchMan(3, 1); SpriteBatchMan.SetActive(this.poSpriteBatchMan); this.poGameObjectMan = new GameObjectMan(10, 2); GameObjectMan.SetActive(this.poGameObjectMan); this.poInputMan = new InputMan(); InputMan.SetActive(this.poInputMan); this.poFontMan = new FontMan(); FontMan.SetActive(this.poFontMan); this.poTimerMan = new TimerMan(); TimerMan.SetActive(this.poTimerMan); SpriteBatch pSB_texts = SpriteBatchMan.Add(SpriteBatch.Name.Texts, 100, true); Logo logo = new Logo(GameObject.Name.Logo, GameSprite.Name.Logo, 400, 400); logo.ActivateGameSprite(pSB_texts); GameObjectMan.Attach(logo); Texture pTexture = TextureMan.Add(Texture.Name.Consolas36pt, "Consolas36pt.tga"); GlyphMan.AddXml(Glyph.Name.Consolas36pt, "Consolas36pt.xml", Texture.Name.Consolas36pt); pTexture = TextureMan.Add(Texture.Name.Consolas20pt, "Consolas20pt.tga"); GlyphMan.AddXml(Glyph.Name.Consolas20pt, "Consolas20pt.xml", Texture.Name.Consolas20pt); pTexture = TextureMan.Add(Texture.Name.Consolas20pt, "Consolas20pt.tga"); GlyphMan.AddXml(Glyph.Name.NullObject, "Consolas20pt.xml", Texture.Name.Consolas20pt); Font pFont = FontMan.Add(Font.Name.SinglePlayer, SpriteBatch.Name.Texts, "Single Player", Glyph.Name.Consolas20pt, 200, 300); pFont.SetColor(0.60f, 0.60f, 0.60f); InputSubject pInputSubject = InputMan.GetCursorSubject(); pInputSubject.Attach(new HighlightHoverTextObserver(pFont)); pInputSubject = InputMan.GetMouseLeftKeySubject(); pInputSubject.Attach(new SinglePlayerChoiceObserver(pFont)); pFont = FontMan.Add(Font.Name.MultiPlayer, SpriteBatch.Name.Texts, "Multi Player", Glyph.Name.Consolas20pt, 200, 275); pFont.SetColor(0.60f, 0.60f, 0.60f); pInputSubject = InputMan.GetCursorSubject(); pInputSubject.Attach(new HighlightHoverTextObserver(pFont)); pInputSubject = InputMan.GetMouseLeftKeySubject(); pInputSubject.Attach(new MultiPlayerChoiceObserver(pFont)); pFont = FontMan.Add(Font.Name.Instructions, SpriteBatch.Name.Texts, "Instructions", Glyph.Name.Consolas20pt, 200, 250); pFont.SetColor(0.60f, 0.60f, 0.60f); pInputSubject = InputMan.GetCursorSubject(); pInputSubject.Attach(new HighlightHoverTextObserver(pFont)); pInputSubject = InputMan.GetMouseLeftKeySubject(); pInputSubject.Attach(new InstructionsChoiceObserver(pFont)); pFont = FontMan.Add(Font.Name.HighScores, SpriteBatch.Name.Texts, "High Scores", Glyph.Name.Consolas20pt, 200, 225); pFont.SetColor(0.60f, 0.60f, 0.60f); pInputSubject = InputMan.GetCursorSubject(); pInputSubject.Attach(new HighlightHoverTextObserver(pFont)); pInputSubject = InputMan.GetMouseLeftKeySubject(); pInputSubject.Attach(new HighScoresChoiceObserver(pFont)); pFont = FontMan.Add(Font.Name.Aliens, SpriteBatch.Name.Texts, "Aliens", Glyph.Name.Consolas20pt, 200, 200); pFont.SetColor(0.60f, 0.60f, 0.60f); pInputSubject = InputMan.GetCursorSubject(); pInputSubject.Attach(new HighlightHoverTextObserver(pFont)); pInputSubject = InputMan.GetMouseLeftKeySubject(); pInputSubject.Attach(new AliensChoiceObserver(pFont)); pFont = FontMan.Add(Font.Name.Credits, SpriteBatch.Name.Texts, "Credits", Glyph.Name.Consolas20pt, 200, 175); pFont.SetColor(0.60f, 0.60f, 0.60f); pInputSubject = InputMan.GetCursorSubject(); pInputSubject.Attach(new HighlightHoverTextObserver(pFont)); pInputSubject = InputMan.GetMouseLeftKeySubject(); pInputSubject.Attach(new CreditsChoiceObserver(pFont)); pFont = FontMan.Add(Font.Name.Exit, SpriteBatch.Name.Texts, "Exit", Glyph.Name.Consolas20pt, 200, 150); pFont.SetColor(0.60f, 0.60f, 0.60f); pInputSubject = InputMan.GetCursorSubject(); pInputSubject.Attach(new HighlightHoverTextObserver(pFont)); pInputSubject = InputMan.GetMouseLeftKeySubject(); pInputSubject.Attach(new ExitObserver(pFont)); }