public override void Notify() { // we need to revert lvl1 or lvl2 to original forms // because we lost and will need to re-load content //ship was hit take a life and subtract from score PlayerMan.P1TakeLife(); PlayerMan.SetP1Score(-250); float P1lives = PlayerMan.GetP1Lives(); SpaceInvaders pGame = GameMan.GetGame(); //check if they have more lives if (P1lives == 0) { // last life i was stil able to shoot Ship pShip = ShipMan.GetShip(); pShip.SetShootState(ShipMan.ShootState.End); pShip.SetMoveState(ShipMan.MoveState.NoMove); GameState pState = pGame.GetCurrentState(); if (pState.GetStateName() == GameMan.State.InGame) { InGameState pLvl1 = (InGameState)pState; pLvl1.SetStateToggle(false); TimerMan.Add(TimeEvent.Name.GameStateChange, new GameStateChange(false), 5.0f); } else if (pState.GetStateName() == GameMan.State.LVL2) { InGameStateLV2 pLvl2 = (InGameStateLV2)pState; pLvl2.SetStateToggle(false); TimerMan.Add(TimeEvent.Name.GameStateChange, new GameStateChange(false), 5.0f); } } else { //do nothing } }
public override void Update() { SpaceInvaders pGame = GameMan.GetGame(); pGame.sndEngine.Update(); InputManager.Update(); Simulation.Update(pGame.GetTime()); if (Simulation.GetTimeStep() > 0.0f) { //start timer TimerMan.Update(Simulation.GetTotalTime()); //Update all the game objects(nodes) GONodeMan.Update(); //check for collisions ColPairMan.Process(); //process observers DelayedObjectMan.Process(); } //--------------------------------------------------------------------------------------------------------- // Font Practice //--------------------------------------------------------------------------------------------------------- Font pScoreMessage = FontMan.Find(Font.Name.P1Points); Debug.Assert(pScoreMessage != null); pScoreMessage.UpdateMessage("" + (PlayerMan.GetP1Score())); Font pHiScore = FontMan.Find(Font.Name.HiPoints); Debug.Assert(pHiScore != null); pHiScore.UpdateMessage("" + PlayerMan.GetHiScore()); Font pP1LivesLeft = FontMan.Find(Font.Name.LivesP1); Debug.Assert(pP1LivesLeft != null); pP1LivesLeft.UpdateMessage("P1 Lives: " + (PlayerMan.GetP1Lives())); }
public override void Execute() { //GameObject pShipRoot = GONodeMan.Find(GameObject.Name.ShipRoot); GameObject pShipObject = (GameObject)this.pShip; this.pShip.Remove(); //pShipRoot.Remove(this.pShip); float repairs = PlayerMan.GetP1Lives(); if (repairs != 0) { TimerMan.Add(TimeEvent.Name.FixShip, new FixShip(), 1.0f); } }