public override void Execute() { Font pTestMessage = FontMan.Find(Font.Name.Life); Debug.Assert(pTestMessage != null); String life = SceneStateGame.GetPlayerLife(SceneStateGame.GetCurrPlayer()).ToString(); pTestMessage.UpdateMessage(life); }
public override void Notify() { this.pShip = (Ship)this.pSubject.pObjB; int mode = SceneStateGame.GetPlayMode(); if (mode == 1) { int lifeLeft = SceneStateGame.GetPlayerLife(1); SceneStateGame.SetPlayerLife(1, lifeLeft - 1); lifeLeft = SceneStateGame.GetPlayerLife(1); if (lifeLeft == 0) { this.state = false; CreateShipObserver pCreateShipObserver = new CreateShipObserver(this); ChangeScene pChangeScene = new ChangeScene(pCreateShipObserver); TimerMan.Add(TimerEvent.Name.AnimShip, pChangeScene, 0.2f, false); this.pShip.SetState(ShipMan.State.End); //DelayedObjectMan.Attach(pCreateShipObserver); } else { ShipMan.Create(new SndObserver(this.pSndEngine, SndObserver.Name.ShootMissile)); } } else if (mode == 2) { int player = SceneStateGame.GetCurrPlayer(); int lifeLeft = SceneStateGame.GetPlayerLife(player); SceneStateGame.SetPlayerLife(player, lifeLeft - 1); int currPlayerLifeLeft = SceneStateGame.GetPlayerLife(player); int nextPlayerLifeLeft = SceneStateGame.GetPlayerLife(2 - player / 2); if (nextPlayerLifeLeft == 0 && currPlayerLifeLeft == 0) { this.state = false; CreateShipObserver pCreateShipObserver = new CreateShipObserver(this); ChangeScene pChangeScene = new ChangeScene(pCreateShipObserver); TimerMan.Add(TimerEvent.Name.AnimShip, pChangeScene, 0.2f, false); this.pShip.SetState(ShipMan.State.End); //DelayedObjectMan.Attach(pCreateShipObserver); } else if (nextPlayerLifeLeft == 0 && currPlayerLifeLeft != 0) { ShipMan.Create(new SndObserver(this.pSndEngine, SndObserver.Name.ShootMissile)); } else if (nextPlayerLifeLeft != 0) { this.state = true; SceneStateGame.SetCurrPlayer(2 - player / 2); CreateShipObserver pCreateShipObserver = new CreateShipObserver(this); ChangeScene pChangeScene = new ChangeScene(pCreateShipObserver); TimerMan.Add(TimerEvent.Name.AnimShip, pChangeScene, 0.2f, false); this.pShip.SetState(ShipMan.State.End); //DelayedObjectMan.Attach(pCreateShipObserver); } else { Debug.Assert(false); } int currLevel = SceneStateGame.GetCurrLevel(); if (currLevel == 1) { SceneStateGame.SetBaseY(600.0f); SceneStateGame.SetMoveRate(1.5f); } else { SceneStateGame.SetBaseY(450.0f); SceneStateGame.SetMoveRate(1.0f); } } else { Debug.Assert(false); } }