public override void Notify() { this.pBomb = (Bomb)this.pSubject.pObjA; Debug.Assert(this.pBomb != null); if (pBomb.bMarkForDeath == false) { pBomb.bMarkForDeath = true; // Delay RemoveBombObserver pObserver = new RemoveBombObserver(this); DelayedObjectMan.Attach(pObserver); } if (this.pSubject.pObjB is WallBottom) { //--------------------------------------------------------------------------------------------------------- // Explosion //--------------------------------------------------------------------------------------------------------- Explosion explosion = new Explosion(GameObject.Name.Explosion_Ground, GameSprite.Name.Explosion_Ground, this.pBomb.x, this.pBomb.y); SpriteBatch pSB_Aliens = SpriteBatchMan.Find(SpriteBatch.Name.Aliens); explosion.ActivateGameSprite(pSB_Aliens); GameObjectMan.Attach(explosion); TimerMan.Add(TimeEvent.Name.RemoveExplosion, new RemoveExplosionCommand(explosion), 0.25f); } }
public override void Notify() { // Delete missile Debug.WriteLine("ShipRemoveMissileObserver: {0} {1}", this.pSubject.pObjA, this.pSubject.pObjB); // At this point we have two game objects // Actually we can control the objects in the visitor // Alphabetical ordering... A is missile, B is wall // This cast will throw an exception if I'm wrong this.pMissile = (Missile)this.pSubject.pObjA; Debug.WriteLine("MissileRemoveObserver: --> delete missile {0}", pMissile); if (pMissile.bMarkForDeath == false) { pMissile.bMarkForDeath = true; // Delay - remove object later // ToDo - reduce the new functions ShipRemoveMissileObserver pObserver = new ShipRemoveMissileObserver(this, pSpriteBatchMan); DelayedObjectMan.Attach(pObserver); } }
public override void Notify() { // Delete missile //Debug.WriteLine("ShipRemoveMissileObserver: {0} {1}", this.pSubject.pObjA, this.pSubject.pObjB); // At this point we have two game objects // Actually we can control the objects in the visitor // Alphabetical ordering... A is missile, B is wall // This cast will throw an exception if I'm wrong this.pMissile = (Missile)this.pSubject.pObjA; //Debug.WriteLine("MissileRemoveObserver: --> delete missile {0}", pMissile); if (pMissile.bMarkForDeath == false) { pMissile.bMarkForDeath = true; // Delay - remove object later // ToDo - reduce the new functions //AnimationSprite pAnimUFODies = new AnimationSprite(GameSprite.Name.Missile); //pAnimUFODies.Attach(Image.Name.MissileBombDies); //TimerMan.Add(TimerEvent.Name.SquidAnimation, pAnimUFODies, 0.00f, false); RemoveMissileObserver pObserver = new RemoveMissileObserver(this); DelayedObjectMan.Attach(pObserver); } }
public override void Notify() { //Double-check to verify the different visitor pattern this.pUFO = (UFO)this.pSubject.pObjA; this.pWall = (WallCategory)this.pSubject.pObjB; Debug.Assert(this.pUFO != null); if (pUFO.bMarkForDeath == false) { pUFO.bMarkForDeath = true; //this is to eliminate some of the checks that the UFORoot //does with the wall while it generates another UFO UFORoot pUFORoot = (UFORoot)GONodeMan.Find(GameObject.Name.UFORoot); Debug.Assert(pUFORoot != null); pUFORoot.x = -100; pUFORoot.y = -100; pUFORoot.SetDeltaMove(-1.0f); MissedUFOobserver pObserver = new MissedUFOobserver(this); DelayedObjectMan.Attach(pObserver); } }
public override void Notify() { GameObject pObject = this.pSubject.pObjA; this.pShip = (Ship)this.pSubject.pObjB; Debug.Assert(pShip != null); if (pShip.bMarkForDeath == false) { this.pShip.bMarkForDeath = true; //had initially tried to use the reference "this" ship //did not work FYI, needed to get the ship from manager Ship pShip = ShipMan.GetShip(); pShip.SetShootState(ShipMan.ShootState.End); pShip.SetMoveState(ShipMan.MoveState.NoMove); HitShipObserver pObserver = new HitShipObserver(this); DelayedObjectMan.Attach(pObserver); } //very wierd not sure how i feel about it if (pObject.GetName() == GameObject.Name.Octopus || pObject.GetName() == GameObject.Name.Squid || pObject.GetName() == GameObject.Name.Crab) { //we want to reset the grids location AlienGroup pGrid = (AlienGroup)GONodeMan.Find(GameObject.Name.AlienGrid); pGrid.MoveUp(); } }
public override void Notify() { this.pAlien = (AlienCategory)this.pSubject.pObjB; if (pAlien.bMarkForDeath == false) { this.IncreaseHorizontalMoveRange(); pAlien.bMarkForDeath = true; GridRemoveAlienObserver pObserver = new GridRemoveAlienObserver(this); DelayedObjectMan.Attach(pObserver); } }
public override void Notify() { this.pBomb = (Bomb)this.pSubject.pObjA; Debug.Assert(this.pBomb != null); if (pBomb.bMarkForDeath == false) { pBomb.bMarkForDeath = true; RemoveBombObserver pObserver = new RemoveBombObserver(this); DelayedObjectMan.Attach(pObserver); } }
public override void Notify() { this.pBrick = (ShieldBrick)this.pSubject.pObjB; Debug.Assert(this.pBrick != null); if (pBrick.bMarkForDeath == false) { pBrick.bMarkForDeath = true; // Delay RemoveBrickObserver pObserver = new RemoveBrickObserver(this, pSpriteBatchMan); DelayedObjectMan.Attach(pObserver); } }
public override void Notify() { //delete bomb this.pBomb = (Bomb)this.pSubject.pObjA; Debug.Assert(this.pBomb != null); if (pBomb.bMarkForDeath == false) { pBomb.bMarkForDeath = true; // Delay RemoveBombObserver pObserver = new RemoveBombObserver(this, pSpriteBatchMan); DelayedObjectMan.Attach(pObserver); } }
public override void Notify() { this.pUFO = (UFO)this.pSubject.pObjB; Debug.Assert(this.pUFO != null); if (pUFO.bMarkForDeath == false) { pUFO.bMarkForDeath = true; // Delay RemoveUFOObserver2 pObserver = new RemoveUFOObserver2(this); DelayedObjectMan.Attach(pObserver); } }
public override void notify() { this.pBomb = this.pSubject.pObjA; Debug.Assert(this.pBomb != null); if (pBomb.bMarkForDeath == false) { pBomb.bMarkForDeath = true; // Delay BombExplosionObsever pObserver = new BombExplosionObsever(this); DelayedObjectMan.Attach(pObserver); } }
public override void Notify() { this.pMissile = (Missile)this.pSubject.pObjA; Debug.Assert(this.pMissile != null); if (pMissile.bMarkForDeath == false) { pMissile.bMarkForDeath = true; // Delay RemoveMissileObserver pObserver = new RemoveMissileObserver(this); DelayedObjectMan.Attach(pObserver); } }
public override void Notify() { this.pGameObj = (GameObject)this.pSubject.pObjA; this.pAlien = (AlienCategory)this.pSubject.pObjB; Debug.Assert(this.pAlien != null); if (pAlien.bMarkForDeath == false) { pAlien.bMarkForDeath = true; // Delay RemoveAlienObserver pObserver = new RemoveAlienObserver(this); DelayedObjectMan.Attach(pObserver); } }
//---------------------------------------------------------------------- // Override abstract class //---------------------------------------------------------------------- public override void notify() { this.pShip = (Ship)this.pSubject.pObjB; Debug.Assert(this.pShip != null); if (pShip.bMarkForDeath == false) { pShip.bMarkForDeath = true; // Delay RemoveShipObserver pObserver = new RemoveShipObserver(this); DelayedObjectMan.Attach(pObserver); } }
//--------------------------------------------------------------------------------------------------------- // Override abstract method //--------------------------------------------------------------------------------------------------------- public override void notify() { //Debug.WriteLine("RemoveAlien_Observer: {0} {1}", this.pSubject.pObjA, this.pSubject.pObjB); this.pUFO = this.pSubject.pObjA; Debug.Assert(this.pUFO != null); if (pUFO.bMarkForDeath == false) { pUFO.bMarkForDeath = true; // Delay UFOExplosionObserver pObserver = new UFOExplosionObserver(this); DelayedObjectMan.Attach(pObserver); } }
public override void Notify() { // Delete missile //Debug.WriteLine("RemoveMissileObserver: {0} {1}", this.pSubject.pObjA, this.pSubject.pObjB); this.pMissile = (Missile)this.pSubject.pObjA; Debug.Assert(this.pMissile != null); if (pMissile.bMarkForDeath == false) { pMissile.bMarkForDeath = true; // Delay RemoveMissileObserver pObserver = new RemoveMissileObserver(this, pSpriteBatchMan); DelayedObjectMan.Attach(pObserver); } }
public override void Notify() { // Delete missile //Debug.WriteLine("RemoveBombObserver: {0} {1}", this.pSubject.pObjA, this.pSubject.pObjB); this.pBomb = (Bomb)this.pSubject.pObjA; Debug.Assert(this.pBomb != null); if (pBomb.bMarkForDeath == false) { pBomb.bMarkForDeath = true; // Delay RemoveBombObserver pObserver = new RemoveBombObserver(this); DelayedObjectMan.Attach(pObserver); } }
public override void Notify() { //remove Brick //Debug.WriteLine("RemoveBrickObserver: {0} {1}", this.pSubject.pObjA, this.pSubject.pObjB); this.pBrick = (ShieldBrick)this.pSubject.pObjB; Debug.Assert(this.pBrick != null); if (pBrick.bMarkForDeath == false) { pBrick.bMarkForDeath = true; //pass brick reference to manager thats executes/removes objects later RemoveBrickObserver pObserver = new RemoveBrickObserver(this); DelayedObjectMan.Attach(pObserver); } }
public override void Notify() { // Remove MissileObserver ObjectA is missile, this.pMissile = (Missile)this.pSubject.pObjA; Debug.Assert(this.pMissile != null); if (pMissile.bMarkForDeath == false) { pMissile.bMarkForDeath = true; //pass missile reference to manager thats executes/removes objects later RemoveMissileObserver pObserver = new RemoveMissileObserver(this); DelayedObjectMan.Attach(pObserver); } }
public override void Execute(float deltaTime, TimeEvent.Name name) { if (this.pGameObject.bMarkForDeath == false) { this.pGameObject.bMarkForDeath = true; // Delay //switch (this.pGameObject.name) //{ // case GameObject.Name.Ship: // ShipMan.DettachShip(); // break; //} RemoveAlienObserver pObserver = new RemoveAlienObserver(pSpriteBatchMan); pObserver.SetGameObject(this.pGameObject); DelayedObjectMan.Attach(pObserver); } }
public override void Notify() { // Delete missile //Debug.WriteLine("RemoveBrickObserver: {0} {1}", this.pSubject.pObjA, this.pSubject.pObjB); this.pAlien = this.pSubject.pObjB; //Image pImage = ImageMan.Find(Image.Name.Splash); //this.pAlien.poProxySprite.Set(GameSprite.Name.Splash); //this.pAlien.Update(); Debug.Assert(this.pAlien != null); if (pAlien.bMarkForDeath == false) { pAlien.bMarkForDeath = true; // Delay RemoveAlienObserver pObserver = new RemoveAlienObserver(this, pSpriteBatchMan); DelayedObjectMan.Attach(pObserver); } }
public override void Notify() { // At this point we have two game objects // Actually we can control the objects in the visitor // Alphabetical ordering... A is missile, B is wall // This cast will throw an exception if I'm wrong this.pShip = (Ship)this.pSubject.pObjB; if (pShip.bMarkForDeath == false) { pShip.bMarkForDeath = true; // Delay - remove object later // TODO - reduce the new functions RemoveShipObserver pObserver = new RemoveShipObserver(this); DelayedObjectMan.Attach(pObserver); } }
public override void Notify() { this.pUFO = (UFO)this.pSubject.pObjA; Debug.Assert(this.pUFO != null); if (pUFO.bMarkForDeath == false) { pUFO.bMarkForDeath = true; // Delay //AnimationSprite pAnimUFODies = new AnimationSprite(GameSprite.Name.UFO); //pAnimUFODies.Attach(Image.Name.UFODies); //pAnimUFODies.Attach(Image.Name.UFO); //TimerMan.Add(TimerEvent.Name.SquidAnimation, pAnimUFODies, 0.01f, false); RemoveUFOObserver pObserver = new RemoveUFOObserver(this); DelayedObjectMan.Attach(pObserver); } }
//--------------------------------------------------------------------------------------------------------- // Override abstract methods //--------------------------------------------------------------------------------------------------------- public override void notify() { if (this.pKiller == GameObject.Name.Missile) { this.pBrick = (ShieldBrick)this.pSubject.pObjA; } else if (this.pKiller == GameObject.Name.Bomb) { this.pBrick = (ShieldBrick)this.pSubject.pObjB; } Debug.Assert(this.pBrick != null); if (pBrick.bMarkForDeath == false) { pBrick.bMarkForDeath = true; // Delay RemoveShieldObserver pObserver = new RemoveShieldObserver(this); DelayedObjectMan.Attach(pObserver); } }
public override void Notify() { this.pBomb = (Bomb)this.pSubject.pObjA; Debug.Assert(this.pBomb != null); this.pMissile = (Missile)this.pSubject.pObjB; Debug.Assert(this.pMissile != null); if (pBomb.bMarkForDeath == false) { pBomb.bMarkForDeath = true; if (pMissile.bMarkForDeath == false) { pMissile.bMarkForDeath = true; BombMissileObserver pObserver = new BombMissileObserver(this); DelayedObjectMan.Attach(pObserver); } } }
public override void Notify() { this.pBomb = (Bomb)this.pSubject.pObjA; MissileGroup pMissileGroup = (MissileGroup)this.pSubject.pObjB; this.pMissile = (Missile)Iterator.GetChild(pMissileGroup); Debug.Assert(this.pMissile != null); if (this.pBomb.bMarkForDeath == false) { this.pBomb.bMarkForDeath = true; } if (this.pMissile.bMarkForDeath == false) { this.pBomb.bMarkForDeath = true; } // Delay RemoveMissileAndBombObserver pObserver = new RemoveMissileAndBombObserver((Bomb)this.pBomb, (Missile)this.pMissile); DelayedObjectMan.Attach(pObserver); //--------------------------------------------------------------------------------------------------------- // Sound //--------------------------------------------------------------------------------------------------------- SoundMan.PlaySound(Sound.Name.InvaderKilled); TimeEvent pTimeEvent = TimerMan.Find(TimeEvent.Name.ScenePlaySound); //--------------------------------------------------------------------------------------------------------- // Explosion //--------------------------------------------------------------------------------------------------------- Explosion explosion = new Explosion(GameObject.Name.Explosion, GameSprite.Name.Explosion, this.pBomb.x, this.pBomb.y); SpriteBatch pSB_Aliens = SpriteBatchMan.Find(SpriteBatch.Name.Aliens); explosion.ActivateGameSprite(pSB_Aliens); GameObjectMan.Attach(explosion); TimerMan.Add(TimeEvent.Name.RemoveExplosion, new RemoveExplosionCommand(explosion), 0.25f); }
public override void Notify() { if (GamePlayingState.playLives > 1) { GamePlayingState.playLives -= 1; //Debug.Assert(ShipMan.GetShip() == null); ShipMan.Attach(pSpriteBatchMan); } else { CheckPlayerStatusObserver pCheck = new CheckPlayerStatusObserver(this); DelayedObjectMan.Attach(pCheck); //SpaceInvaders pSI = SpaceInvaders.GetInstance(); //pSI.UnLoadContent(); //pSI.SetState(SpaceInvaders.State.EndGameState); //pSI.LoadContent(); //if (pSI.scoreOne > pSI.scoreTwo) //{ // if (pSI.scoreOne > pSI.scoreHigh) // { // pSI.scoreHigh = pSI.scoreOne; // } //} //else //{ // if (pSI.scoreTwo > pSI.scoreHigh) // { // pSI.scoreHigh = pSI.scoreTwo; // } //} //MoveToEndStateEvent pMoveToEndEvent = new MoveToEndStateEvent(pSI); //TimerMan.Add(TimeEvent.Name.MoveToEndState, pMoveToEndEvent, 0.5f); } }
public override void Notify() { GameObject placeObject; if (this.p == 1) { placeObject = this.pSubject.pObjA; } else { placeObject = this.pSubject.pObjB; } // TODO new ?? GameObject pGameObjDies = this.factory.Create(this.pGOname, this.pGSname, this.container, placeObject.x, placeObject.y); //SpriteBatch pSB_Aliens = SpriteBatchMan.Find(SpriteBatch.Name.Aliens); //SpriteBatch pSB_Box = SpriteBatchMan.Find(SpriteBatch.Name.Boxes); //GameObject pGameObjDies = new AlienDies(this.pGOname, this.pGSname, placeObject.x, placeObject.y); //GameObject pExplosionGroup = GameObjectMan.Find(GameObject.Name.ExplosionGroup); //Debug.Assert(pExplosionGroup != null); //pExplosionGroup.Add(pGameObjDies); //pGameObjDies.ActivateGameSprite(pSB_Aliens); //pGameObjDies.ActivateCollisionSprite(pSB_Box); this.pGameObj = pGameObjDies; if (pGameObj.bMarkForDeath == false) { pGameObj.bMarkForDeath = true; // Delay ExplosionObserver pObserver = new ExplosionObserver(this); DelayedObjectMan.Attach(pObserver); } }
public override void Notify() { this.pUFO = (UFO)this.pSubject.pObjB; Debug.Assert(this.pUFO != null); if (pUFO.bMarkForDeath == false) { pUFO.bMarkForDeath = true; //this is to eliminate some of the checks that the UFORoot //does with the wall while it generates another UFO UFORoot pUFORoot = (UFORoot)GONodeMan.Find(GameObject.Name.UFORoot); Debug.Assert(pUFORoot != null); pUFORoot.x = -100; pUFORoot.y = -100; pUFORoot.SetDeltaMove(-1.0f); RemoveUFOobserver pObserver = new RemoveUFOobserver(this); DelayedObjectMan.Attach(pObserver); } }
public override void Notify() { //remove alien //Debug.WriteLine("RemoveAlienObserver: {0} {1}", this.pSubject.pObjA, this.pSubject.pObjB); //a little tricky ObjA is the missile, we are not alphabetical //because of how the missile observer is set up this.pAlien = (AlienCategory)this.pSubject.pObjB; Debug.Assert(this.pAlien != null); if (pAlien.bMarkForDeath == false) { pAlien.bMarkForDeath = true; if (pAlien.GetName() == GameObject.Name.Squid) { PlayerMan.SetP1Score(30); } else if (pAlien.GetName() == GameObject.Name.Crab) { PlayerMan.SetP1Score(40); } else { PlayerMan.SetP1Score(50); } //pass brick reference to manager thats executes/removes objects later RemoveAlienObserver pObserver = new RemoveAlienObserver(this); DelayedObjectMan.Attach(pObserver); } }