private static Ship ActivateShip(SpriteBatchMan pSpriteBatchMan) { ShipMan pShipMan = ShipMan.PrivInstance(); Debug.Assert(pShipMan != null); // copy over safe copy Ship pShip = new Ship(GameObject.Name.Ship, GameSprite.Name.Ship, 150, 50); pShipMan.pShip = pShip; // Attach the sprite to the correct sprite batch SpriteBatch pSB_Aliens = pSpriteBatchMan.Find(SpriteBatch.Name.Aliens); pSB_Aliens.Attach(pShip.poProxySprite); SpriteBatch pSB_Box = pSpriteBatchMan.Find(SpriteBatch.Name.Boxes); pSB_Box.Attach(pShip.GetColObject().pColSprite); // Attach the missile to the missile root GameObject pShipRoot = GameObjectMan.Find(GameObject.Name.ShipRoot); Debug.Assert(pShipRoot != null); // Add to GameObject Tree - {update and collisions} pShipRoot.Add(pShipMan.pShip); return(pShipMan.pShip); }
public ShieldFactory(SpriteBatchMan pSpriteBatchMan, SpriteBatch.Name spriteBatchName, SpriteBatch.Name collisionSpriteBatch, Composite pTree) { this.pSpriteBatch = pSpriteBatchMan.Find(spriteBatchName); Debug.Assert(this.pSpriteBatch != null); this.pCollisionSpriteBatch = pSpriteBatchMan.Find(collisionSpriteBatch); Debug.Assert(this.pCollisionSpriteBatch != null); Debug.Assert(pTree != null); this.pTree = pTree; }
public UFODisplay(SpriteBatchMan pSpriteBatchMan, SpriteBatch.Name spriteBatchName, SpriteBatch.Name collisionSpriteBatch, GameObject.Name name, GameSprite.Name spriteName, Composite pTree) { this.pSpriteBatch = pSpriteBatchMan.Find(spriteBatchName); Debug.Assert(this.pSpriteBatch != null); this.pCollisionSpriteBatch = pSpriteBatchMan.Find(collisionSpriteBatch); Debug.Assert(this.pCollisionSpriteBatch != null); //this.type = type; this.gameObjectName = name; this.spriteName = spriteName; this.pTree = pTree; this.flag = true; }
private static Ship ActivateShip(SndObserver pSnd) { ShipMan pShipMan = ShipMan.PrivInstance(); Debug.Assert(pShipMan != null); // copy over safe copy Ship pShip = new Ship(GameObject.Name.Ship, GameSprite.Name.Ship, 300, 55, pSnd); pShipMan.pShip = pShip; // Attach the sprite to the correct sprite batch //SpriteBatch pSB_Aliens = SpriteBatchMan.Find(SpriteBatch.Name.Aliens); //pSB_Aliens.Attach(pShip.pProxySprite); SpriteBatch pSB_Aliens = SpriteBatchMan.Find(SpriteBatch.Name.Aliens); SpriteBatch pSB_Boxes = SpriteBatchMan.Find(SpriteBatch.Name.Boxes); pShip.ActivateCollisionSprite(pSB_Boxes); pShip.ActivateGameSprite(pSB_Aliens); // Attach the missile to the missile root GameObject pShipRoot = GameObjectMan.Find(GameObject.Name.ShipRoot); Debug.Assert(pShipRoot != null); // Add to GameObject Tree - {update and collisions} pShipRoot.Add(pShipMan.pShip); return(pShipMan.pShip); }
public override void Handle() { SpriteBatch pGameOverScreen = SpriteBatchMan.Find(SpriteBatch.Name.GameOver); pGameOverScreen.bToggle = true; SpriteBatch pSB_Aliens = SpriteBatchMan.Find(SpriteBatch.Name.Aliens); pSB_Aliens.bToggle = false; SpriteBatch pSB_Shields = SpriteBatchMan.Find(SpriteBatch.Name.Shields); pSB_Shields.bToggle = false; SpriteBatch pSB_InGame = SpriteBatchMan.Find(SpriteBatch.Name.InGameScreen); pSB_InGame.bToggle = false; SpriteBatch pSB_Projectiles = SpriteBatchMan.Find(SpriteBatch.Name.Projectiles); pSB_Projectiles.bToggle = false; PlayerMan.UpdateHiScore(); PlayerMan.ClearStuff(); }
public static Bomb ActivateBomb(UFOCategory pUFO) { UFOMan pUFOMan = UFOMan.PrivInstance(); Debug.Assert(pUFOMan != null); Bomb pBombObj = new Bomb(GameObject.Name.Bomb, GameSprite.Name.BombFork, new FallTuning(), pUFO.x, pUFO.y, pUFO); pUFOMan.pBomb = pBombObj; SpriteBatch pSB_Aliens = SpriteBatchMan.Find(SpriteBatch.Name.Aliens); SpriteBatch pSB_Box = SpriteBatchMan.Find(SpriteBatch.Name.Boxes); pBombObj.ActivateCollisionSprite(pSB_Box); pBombObj.ActivateGameSprite(pSB_Aliens); // Attach the missile to the missile root GameObject pBombRoot = GameObjectMan.Find(GameObject.Name.BombRoot); Debug.Assert(pBombRoot != null); // Add to GameObject Tree - {update and collisions} pBombRoot.Add(pUFOMan.pBomb); return(pUFOMan.pBomb); }
public override void Handle() { //handle is called before entering gamestate loops //fight the wave if (bWaveFinished == false) { Debug.WriteLine("Wave 1"); Debug.WriteLine("-----------------------------------------------------------------"); // De-activate sprite batch SpriteBatch pIntroScreen = SpriteBatchMan.Find(SpriteBatch.Name.IntroScreen); pIntroScreen.bToggle = false; this.bWaveFinished = true; LoadContent(); //Update(); } // wave is finished go to the next one else { Debug.WriteLine("Wave 2"); Debug.WriteLine("-----------------------------------------------------------------"); this.bWaveFinished = false; SpaceInvaders pGame = GameMan.GetGame(); pGame.SetGameState(GameMan.State.LVL2); pGame.GetCurrentState().Handle(); } }
public static Bomb ActiveBomb() { //ensure call Create() first BombMan pMan = BombMan.GetInstance(); Debug.Assert(pMan != null); GameSprite.Name spriteName = GameSprite.Name.BombDagger + pMan.randNum.Next(3); FallStrategy pFallStrategy = pMan.chooseFallStrategy(spriteName); Debug.Assert(pFallStrategy != null); // create Bomb Bomb pBomb = new Bomb(GameObject.Name.Bomb, spriteName, pFallStrategy, 100, 100); // activate collision sprite and game sprite pBomb.activateGameSprite(SpriteBatchMan.Find(SpriteBatch.Name.Bombs)); pBomb.activateCollisionSprite(SpriteBatchMan.Find(SpriteBatch.Name.Boxes)); //attach Bomb to BombGroup GameObject pBombGroup = GameObjectMan.Find(GameObject.Name.BombGroup); Debug.Assert(pBombGroup != null); // add to GameObject pBombGroup.add(pBomb); return(pBomb); }
public override void Notify() { //when this notify is called we swap the images and draw it to the alien spritebatch //then maybe add a time event that..... removes it somehow... remove from spritebatch after a half second GameObject pObject = this.pSubject.pObjB; Debug.Assert(pObject != null); GameSprite pShipSplat = GameSpriteMan.Find(GameSprite.Name.ShipSplat); //future concept //pObject.GetProxy().SetRealSprite(this.pSprite); //get the locations and render the image //I'm really upset about this........ but here we are creating a new pShipSplat.PosX(pObject.x); pShipSplat.PosY(pObject.y); pShipSplat.Update(); SpriteBatch pSB_Aliens = SpriteBatchMan.Find(SpriteBatch.Name.Aliens); pSB_Aliens.Attach(pShipSplat); TimerMan.Add(TimeEvent.Name.SplatAnim, new SplatAnim(pShipSplat, pSB_Aliens), 0.5f); }
public override void Execute() { if (scenePlay.numLives > 1) { GameObject pA = (GameObject)this.pShip; GameObject pB = (GameObject)Iterator.GetParent(pA); pA.Remove(); this.pSB_Aliens = SpriteBatchMan.Find(SpriteBatch.Name.Aliens); Debug.Assert(this.pSB_Aliens != null); this.pSB_Boxes = SpriteBatchMan.Find(SpriteBatch.Name.Boxes); Debug.Assert(this.pSB_Boxes != null); // TODO: Splat Alien - needs a better way this.pSplat = new Splat(GameObject.Name.Splat, GameSprite.Name.SplatShip, pShip.x, pShip.y); pSplat.ActivateCollisionSprite(this.pSB_Boxes); pSplat.ActivateGameSprite(this.pSB_Aliens); GameObject pSplatbRoot = GameObjectMan.Find(GameObject.Name.SplatRoot); Debug.Assert(pSplatbRoot != null); pSplatbRoot.Add(pSplat); TimerMan.Add(TimeEvent.Name.SplatRemoveShip, new SplatRemoveEvent(this.pSplat), 0.6f); this.scenePlay.RemoveLife(); } }
public static Ship ActivateShip() { //ensure call Create() first ShipMan pShipMan = ShipMan.GetInstance(); Debug.Assert(pShipMan != null); // create ship Ship pShip = new Ship(GameObject.Name.Ship, GameSprite.Name.Ship, 440, 90); pShipMan.pShip = pShip; // attach sprite to correct sprite batch SpriteBatch pSB_Ships = SpriteBatchMan.Find(SpriteBatch.Name.Ships); pSB_Ships.attach(pShip.getProxySprite()); // attach ship to ship group GameObject pShipGroup = GameObjectMan.Find(GameObject.Name.ShipGroup); Debug.Assert(pShipGroup != null); // add to GameObject pShipGroup.add(pShipMan.pShip); pShip.activateCollisionSprite(SpriteBatchMan.Find(SpriteBatch.Name.Boxes)); return(pShipMan.pShip); }
public override void Notify() { GameObject pObject = this.pSubject.pObjB; Debug.Assert(pObject != null); GameSprite pUFOSplat = GameSpriteMan.Find(GameSprite.Name.UFOsplat); //future concept //pObject.GetProxy().SetRealSprite(this.pSprite); //get the locations and render the image pUFOSplat.PosX(pObject.x); pUFOSplat.PosY(pObject.y); pUFOSplat.Update(); SpriteBatch pSB_Aliens = SpriteBatchMan.Find(SpriteBatch.Name.Aliens); pSB_Aliens.Attach(pUFOSplat); TimerMan.Add(TimeEvent.Name.SplatAnim, new SplatAnim(pUFOSplat, pSB_Aliens), 0.5f); }
public static Missile ActivateMissile() { //ensure call Create() first ShipMan pShipMan = ShipMan.GetInstance(); Debug.Assert(pShipMan != null); // create Missile Missile pMissile = new Missile(GameObject.Name.Missile, GameSprite.Name.Missile, 400, 100); pShipMan.pMissile = pMissile; // activate collision sprite and game sprite pMissile.activateCollisionSprite(SpriteBatchMan.Find(SpriteBatch.Name.Boxes)); pMissile.activateGameSprite(SpriteBatchMan.Find(SpriteBatch.Name.Missiles)); // attach missile to missile group GameObject pMissileGroup = GameObjectMan.Find(GameObject.Name.MissileGroup); Debug.Assert(pMissileGroup != null); // Add to GameObject pMissileGroup.add(pShipMan.pMissile); return(pShipMan.pMissile); }
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 static Missile ActivateMissile() { //ShipMan pShipMan = ShipMan.PrivInstance(); ShipMan pShipMan = ShipMan.instance; Debug.Assert(pShipMan != null); // copy over safe copy Missile pMissile = new Missile(GameObject.Name.Missile, GameSprite.Name.Missile, 400, 100); pShipMan.pMissile = pMissile; // Attached to SpriteBatches SpriteBatch pSB_Aliens = SpriteBatchMan.Find(SpriteBatch.Name.Aliens); SpriteBatch pSB_Boxes = SpriteBatchMan.Find(SpriteBatch.Name.Boxes); pMissile.ActivateCollisionSprite(pSB_Boxes); pMissile.ActivateGameSprite(pSB_Aliens); // Attach the missile to the missile root GameObject pMissileGroup = GameObjectMan.Find(GameObject.Name.MissileGroup); Debug.Assert(pMissileGroup != null); // Add to GameObject Tree - {update and collisions} pMissileGroup.Add(pShipMan.pMissile); return(pShipMan.pMissile); }
//similar to Activate Missile public static Ship ActivateShip() { ShipMan pShipMan = ShipMan.PrivInstance(); Debug.Assert(pShipMan != null); Ship pShip = new Ship(GameObject.Name.Ship, GameSprite.Name.Ship, 200, 60); pShipMan.poShip = pShip; GameObject pShipRoot = GONodeMan.Find(GameObject.Name.ShipRoot); Debug.Assert(pShipRoot != null); pShipRoot.Add(pShipMan.poShip); SpriteBatch pSB_Aliens = SpriteBatchMan.Find(SpriteBatch.Name.Aliens); SpriteBatch pSB_Boxes = SpriteBatchMan.Find(SpriteBatch.Name.Boxes); pShipMan.poShip.ActivateGameSprite(pSB_Aliens); pShipMan.poShip.ActivateCollisionSprite(pSB_Boxes); pShipMan.TakeLife(1); return(pShipMan.poShip); }
public AlienFactory(SpriteBatch.Name spriteBatchName, SpriteBatch.Name boxSpriteBatchName) { this.pSpriteBatch = SpriteBatchMan.Find(spriteBatchName); Debug.Assert(this.pSpriteBatch != null); this.pBoxSpriteBatch = SpriteBatchMan.Find(boxSpriteBatchName); Debug.Assert(this.pBoxSpriteBatch != null); }
public ShieldFactory(SpriteBatch.Name spriteBatchName, SpriteBatch.Name collisionSpriteBatch) { this.pSpriteBatch = SpriteBatchMan.Find(spriteBatchName); Debug.Assert(this.pSpriteBatch != null); this.pCollisionSpriteBatch = SpriteBatchMan.Find(collisionSpriteBatch); Debug.Assert(this.pCollisionSpriteBatch != null); }
public AliensFactory(SpriteBatch.Name spriteBatchName) { this.pSpriteBatch = SpriteBatchMan.Find(spriteBatchName); Debug.Assert(this.pSpriteBatch != null); this.pBoxBatch = SpriteBatchMan.Find(SpriteBatch.Name.Batch_Boxes); Debug.Assert(this.pBoxBatch != null); }
public ShieldFactory(SpriteBatch.Name spriteBatchName, SpriteBatch.Name collisionSpriteBatch, GameObject.Name shieldRootName) { this.pSpriteBatch = SpriteBatchMan.Find(spriteBatchName); Debug.Assert(this.pSpriteBatch != null); this.pCollisionSpriteBatch = SpriteBatchMan.Find(collisionSpriteBatch); Debug.Assert(this.pCollisionSpriteBatch != null); this.pTree = (Composite) new ShieldRoot(shieldRootName, GameSprite.Name.NullObject, 0.0f, 0.0f); }
public BombObserver(bool showSplat) { this.pSB_Aliens = SpriteBatchMan.Find(SpriteBatch.Name.Aliens); Debug.Assert(this.pSB_Aliens != null); this.pSB_Boxes = SpriteBatchMan.Find(SpriteBatch.Name.Boxes); Debug.Assert(this.pSB_Boxes != null); this.showSplat = showSplat; }
public static Bomb ActivateBomb(AlienCategory pAlien) { AlienMan pAlienMan = AlienMan.PrivInstance(); Debug.Assert(pAlienMan != null); // copy over safe copy byte[] buffer = Guid.NewGuid().ToByteArray(); int iSeed = BitConverter.ToInt32(buffer, 0); Random random = new Random(iSeed); Bomb pBombObj = null; int randint = random.Next(0, 4); switch (randint) { case 0: pBombObj = new Bomb(GameObject.Name.Bomb, GameSprite.Name.BombDagger, new FallDagger(), pAlien.x, pAlien.y, pAlien); break; case 1: pBombObj = new Bomb(GameObject.Name.Bomb, GameSprite.Name.BombRolling, new FallRolling(), pAlien.x, pAlien.y, pAlien); break; case 2: pBombObj = new Bomb(GameObject.Name.Bomb, GameSprite.Name.BombZigZag, new FallZigZag(), pAlien.x, pAlien.y, pAlien); break; case 3: pBombObj = new Bomb(GameObject.Name.Bomb, GameSprite.Name.BombStraight, new FallStraight(), pAlien.x, pAlien.y, pAlien); break; default: Debug.Assert(false); break; } pAlienMan.pBomb = pBombObj; SpriteBatch pSB_Aliens = SpriteBatchMan.Find(SpriteBatch.Name.Aliens); SpriteBatch pSB_Box = SpriteBatchMan.Find(SpriteBatch.Name.Boxes); pBombObj.ActivateCollisionSprite(pSB_Box); pBombObj.ActivateGameSprite(pSB_Aliens); // Attach the missile to the missile root GameObject pBombRoot = GameObjectMan.Find(GameObject.Name.BombRoot); Debug.Assert(pBombRoot != null); // Add to GameObject Tree - {update and collisions} pBombRoot.Add(pAlienMan.pBomb); return(pAlienMan.pBomb); }
public AlienFactory(SpriteBatch.Name spriteBatchName, SpriteBatch.Name colSpriteBatchName, Composite pTree) { this.pSpriteBatch = SpriteBatchMan.Find(spriteBatchName); Debug.Assert(this.pSpriteBatch != null); this.pColSpriteBatch = SpriteBatchMan.Find(colSpriteBatchName); Debug.Assert(this.pColSpriteBatch != null); Debug.Assert(pTree != null); this.pTree = pTree; }
public RemoveUFOObserver(RemoveUFOObserver m) { Debug.Assert(m.pUFO != null); this.pUFO = m.pUFO; this.pSB_Aliens = SpriteBatchMan.Find(SpriteBatch.Name.Aliens); Debug.Assert(this.pSB_Aliens != null); this.pSB_Boxes = SpriteBatchMan.Find(SpriteBatch.Name.Boxes); Debug.Assert(this.pSB_Boxes != null); }
public void clearShield() { this.poHead = null; this.poLast = null; SpriteBatch pSB_shields = SpriteBatchMan.Find(SpriteBatch.Name.Shields); SpriteBatch pSB_shieldBoxes = SpriteBatchMan.Find(SpriteBatch.Name.ShieldBoxes); pSB_shields.deepClear(); pSB_shieldBoxes.deepClear(); this.activateGameSprite(pSB_shields); this.activateCollisionSprite(pSB_shieldBoxes); }
public RemoveAlienObserver(RemoveAlienObserver m) { Debug.Assert(m.pAlien != null); this.pAlien = m.pAlien; this.pSB_Aliens = SpriteBatchMan.Find(SpriteBatch.Name.Aliens); Debug.Assert(this.pSB_Aliens != null); this.pSB_Boxes = SpriteBatchMan.Find(SpriteBatch.Name.Boxes); Debug.Assert(this.pSB_Boxes != null); this.scenePlay = m.scenePlay; }
public ShipRemoveMissileObserver(ShipRemoveMissileObserver m) { Debug.Assert(m.pMissile != null); this.pMissile = m.pMissile; this.pSB_Aliens = SpriteBatchMan.Find(SpriteBatch.Name.Aliens); Debug.Assert(this.pSB_Aliens != null); this.pSB_Boxes = SpriteBatchMan.Find(SpriteBatch.Name.Boxes); Debug.Assert(this.pSB_Boxes != null); this.showSplat = m.showSplat; }
public override void Execute() { GameObject pA = (GameObject)this.pUFO; GameObject pB = (GameObject)Iterator.GetParent(pA); float x = this.pUFO.x; float y = this.pUFO.y; pA.Remove(); // Hacks if (this.pGameObj is MissileGroup) { Missile pMissile = (Missile)Iterator.GetChild(this.pGameObj); // bug but don't crash please if (pMissile == null) { return; } Player pPlayer = pMissile.pPlayer; pPlayer.nPoints += this.pUFO.GetPoints(); Font.Name pFontName = Font.Name.Uninitialized; if (pPlayer.n == 1) { pFontName = Font.Name.Score1Value; } if (pPlayer.n == 2) { pFontName = Font.Name.Score2Value; } Font pScore = FontMan.Find(pFontName); pScore.Set(pFontName, pPlayer.nPoints.ToString(), Glyph.Name.Consolas20pt, pScore.pFontSprite.x, pScore.pFontSprite.y); } SoundMan.PlaySound(Sound.Name.InvaderKilled); Explosion explosion = new Explosion(GameObject.Name.Explosion, GameSprite.Name.Explosion, x, y); SpriteBatch pSB_UFOs = SpriteBatchMan.Find(SpriteBatch.Name.Aliens); explosion.ActivateGameSprite(pSB_UFOs); GameObjectMan.Attach(explosion); TimerMan.Add(TimeEvent.Name.RemoveExplosion, new RemoveExplosionCommand(explosion), 0.25f); }
public BombSpawnEvent(int nCurrLevel, Random pRandom) { this.nCurrLevel = nCurrLevel; this.pBombRoot = GameObjectMan.Find(GameObject.Name.BombRoot); Debug.Assert(this.pBombRoot != null); this.pSB_Bombs = SpriteBatchMan.Find(SpriteBatch.Name.Bombs); Debug.Assert(this.pSB_Bombs != null); this.pSB_Boxes = SpriteBatchMan.Find(SpriteBatch.Name.Boxes); Debug.Assert(this.pSB_Boxes != null); this.pRandom = pRandom; }
public SpawnUFOCommand(Random pRandom, WallLeft pWallLeft, WallRight pWallRight) { this.pUFO = GameObjectMan.Find(GameObject.Name.UFO); Debug.Assert(this.pUFO != null); this.pSB_Aliens = SpriteBatchMan.Find(SpriteBatch.Name.Aliens); Debug.Assert(this.pSB_Aliens != null); this.pSB_Boxes = SpriteBatchMan.Find(SpriteBatch.Name.Boxes); Debug.Assert(this.pSB_Boxes != null); this.pRandom = pRandom; this.pWallLeft = pWallLeft; this.pWallRight = pWallRight; }