public AlienGrid CreateGrid(int xPos, int yPos) { AlienGrid pGrid = (AlienGrid)Create(GameObject.Name.AlienGrid, AlienCategory.Type.Grid, xPos, yPos); GameObject pGameObj; for (int i = 0; i < 11; i++) { GameObject pCol = Create(GameObject.Name.AlienColumn + i, AlienCategory.Type.Column, xPos, yPos); pGameObj = Create(GameObject.Name.BlueAlien, AlienCategory.Type.Blue, xPos + i * 50.0f, yPos); pCol.Add(pGameObj); pGameObj = Create(GameObject.Name.GreenAlien, AlienCategory.Type.Green, xPos + i * 50.0f, yPos - 50); pCol.Add(pGameObj); pGameObj = Create(GameObject.Name.GreenAlien, AlienCategory.Type.Green, xPos + i * 50.0f, yPos - 100); pCol.Add(pGameObj); pGameObj = Create(GameObject.Name.RedAlien, AlienCategory.Type.Red, xPos + i * 50.0f, yPos - 150); pCol.Add(pGameObj); pGameObj = Create(GameObject.Name.RedAlien, AlienCategory.Type.Red, xPos + i * 50.0f, yPos - 200); pCol.Add(pGameObj); pGrid.Add(pCol); pGrid.nNumActive += 5; } GameObjectMan.Attach(pGrid); return(pGrid); }
public void GenerateAlien(GameObjectMan poGameObjectMan) { AlienFactory AF = new AlienFactory(SpriteBatch.Name.Aliens, SpriteBatch.Name.Boxes); GameObject pGameObj; for (int i = 0; i < 11; i++) { GameObject pCol = AF.Create(GameObject.Name.AlienColumn, AlienCategory.Type.Column); pGameObj = AF.Create(GameObject.Name.SquidAlien, AlienCategory.Type.Squid, 250.0f + i * 40.0f, 470.0f); pCol.Add(pGameObj); pGameObj = AF.Create(GameObject.Name.CrabAlien, AlienCategory.Type.Crab, 250.0f + i * 40.0f, 430.0f); pCol.Add(pGameObj); pGameObj = AF.Create(GameObject.Name.CrabAlien, AlienCategory.Type.Crab, 250.0f + i * 40.0f, 390.0f); pCol.Add(pGameObj); pGameObj = AF.Create(GameObject.Name.OctopusAlien, AlienCategory.Type.Octopus, 250.0f + i * 40.0f, 350.0f); pCol.Add(pGameObj); pGameObj = AF.Create(GameObject.Name.OctopusAlien, AlienCategory.Type.Octopus, 250.0f + i * 40.0f, 310.0f); pCol.Add(pGameObj); this.Add(pCol); } GameObjectMan.Attach(this); }
private GameObject BuildLeftRightWallGroup() { GameObject pWallGroup = this.Create(GameObject.Name.WallGroupLeftRight, WallCategory.Type.WallGroup); GameObject pWallRight = this.Create(GameObject.Name.WallRight, WallCategory.Type.Right); GameObject pWallLeft = this.Create(GameObject.Name.WallLeft, WallCategory.Type.Left); // Add to the composite the children pWallGroup.Add(pWallRight); pWallGroup.Add(pWallLeft); GameObjectManager.Attach(pWallGroup); return(pWallGroup); }
private GameObject BuildTopBottomWallGroup() { GameObject pWallGroup = this.Create(GameObject.Name.WallGroupTopBottom, WallCategory.Type.WallGroup); GameObject pWallTop = this.Create(GameObject.Name.WallTop, WallCategory.Type.Top); GameObject pWallBottom = this.Create(GameObject.Name.WallBottom, WallCategory.Type.Bottom); // Add to the composite the children pWallGroup.Add(pWallTop); pWallGroup.Add(pWallBottom); GameObjectManager.Attach(pWallGroup); return(pWallGroup); }
//---------------------------------------------------------------------------------- // Private Methods - Mainly used to help the build method //---------------------------------------------------------------------------------- private void FillSwarmColumn(GameObject pColumn, float px, float py) { GameObject pGameObj; //AlienFactory AF = new AlienFactory(SpriteNodeBatch.Name.TheSwarm, SpriteNodeBatch.Name.Boxes); //Fill first two for (int i = 0; i < 5; i++) { pGameObj = null; if (i < 2) { pGameObj = this.Create(GameObject.Name.Squid, AlienCategory.Type.Squid, px, py - 45.0f * i); } else if (i < 4) { pGameObj = this.Create(GameObject.Name.Alien, AlienCategory.Type.Alien, px, py - 45.0f * i); } else { pGameObj = this.Create(GameObject.Name.Octopus, AlienCategory.Type.Octopus, px, py - 45.0f * i); } Debug.Assert(pGameObj != null); pColumn.Add(pGameObj); } }
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 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); }
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(); } }
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 Missile ActivateMissile() { // copy over safe copy Missile pMissile = new Missile(GameObject.Name.Missile, Sprite.Name.Missile, 400, 100); this.pMissile = pMissile; // Attach to GameObjectManager - {update and collisions} GameStateManager.GetGame().GetStateGameObjectManager().Attach(pMissile); // Attached to SpriteBatches SpriteBatch pMissile_SpriteBatch = GameStateManager.GetGame().GetStateSpriteBatchManager().Find(SpriteBatch.Name.Missile); SpriteBatch pCollisionBox_SpriteBatch = GameStateManager.GetGame().GetStateSpriteBatchManager().Find(SpriteBatch.Name.CollisionBox); pMissile.ActivateSprite(pMissile_SpriteBatch); pMissile.ActivateCollisionSprite(pCollisionBox_SpriteBatch); // Attach the missile to the missile root GameObject pMissileGroup = GameStateManager.GetGame().GetStateCompositeManager().Find(Composite.CompositeName.MissileGroup); Debug.Assert(pMissileGroup != null); // Add to Composite pMissileGroup.Add(this.pMissile); return(this.pMissile); }
public CoreCannon ActivateCoreCannon() { // copy over safe copy CoreCannon pCoreCannon = new CoreCannon(GameObject.Name.CoreCannon, Sprite.Name.CoreCannon, 200, 100); this.pCoreCannon = pCoreCannon; // Attach to GameObjectManager - {update and collisions} GameStateManager.GetGame().GetStateGameObjectManager().Attach(pCoreCannon); // Attach the sprite to the correct sprite batch SpriteBatch pCoreCannon_SpriteBatch = GameStateManager.GetGame().GetStateSpriteBatchManager().Find(SpriteBatch.Name.CoreCannon); SpriteBatch pCollisionBox_SpriteBatch = GameStateManager.GetGame().GetStateSpriteBatchManager().Find(SpriteBatch.Name.CollisionBox); pCoreCannon.ActivateSprite(pCoreCannon_SpriteBatch); pCoreCannon.ActivateCollisionSprite(pCollisionBox_SpriteBatch); // Attach the Core Cannon to the CoreCannonGroup GameObject pCoreCannonGroup = GameStateManager.GetGame().GetStateGameObjectManager().Find(GameObject.Name.CoreCannonGroup); Debug.Assert(pCoreCannonGroup != null); // Add to Composite pCoreCannonGroup.Add(this.pCoreCannon); this.pCoreCannon.SetMissileState(CoreCannonManager.MissileState.Ready); this.pCoreCannon.SetMoveState(CoreCannonManager.MoveState.Free); return(this.pCoreCannon); }
override public void Execute(float deltaTime) { int pFreq = pRandom.Next(1, 10) / this.nCurrLevel; AlienGrid pGrid = (AlienGrid)GameObjectMan.Find(GameObject.Name.AlienGrid); AlienCategory pAlien = pGrid.GetRandomAlien(); // HACK don't crash pleease if (pAlien == null) { TimerMan.Add(TimeEvent.Name.BombSpawn, this, pFreq); return; } int type = pRandom.Next(0, 2); FallStrategy pFallStrategy = null; switch (type) { case (0): pFallStrategy = new FallZigZag(); break; case (1): pFallStrategy = new FallDagger(); break; case (2): pFallStrategy = new FallStraight(); break; } type = pRandom.Next(0, 2); GameSprite.Name pGameSpriteName = GameSprite.Name.Uninitialized; switch (type) { case (0): pGameSpriteName = GameSprite.Name.BombZigZag; break; case (1): pGameSpriteName = GameSprite.Name.BombDagger; break; case (2): pGameSpriteName = GameSprite.Name.BombStraight; break; } Bomb pBomb = new Bomb(GameObject.Name.Bomb, pGameSpriteName, pFallStrategy, pAlien.x, pAlien.y); pBomb.ActivateCollisionSprite(this.pSB_Boxes); pBomb.ActivateGameSprite(this.pSB_Bombs); GameObject pBombRoot = GameObjectMan.Find(GameObject.Name.BombRoot); Debug.Assert(pBombRoot != null); pBombRoot.Add(pBomb); TimerMan.Add(TimeEvent.Name.BombSpawn, this, pFreq); }
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 override void Notify() { Bomb pBomb = null; if (this.pSubject.pObjA.name == GameObject.Name.Bomb) { pBomb = (Bomb)this.pSubject.pObjA; } else if (this.pSubject.pObjB.name == GameObject.Name.Bomb) { pBomb = (Bomb)this.pSubject.pObjB; } Debug.Assert(pBomb != null); pBomb.Reset(); pBomb.Remove(); if (showSplat == true) { // TODO: Splat Alien - needs a better way this.pSplat = new Splat(GameObject.Name.Splat, GameSprite.Name.SplatBomb, pBomb.x, pBomb.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.SplatRemoveBomb, new SplatRemoveEvent(this.pSplat), 0.5f); } }
//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); }
override public void Execute(float deltaTime) { this.pUFO = new UFO(GameObject.Name.UFO, GameSprite.Name.UFO, -20, 530); Debug.Assert(this.pUFO != null); pUFO.ActivateCollisionSprite(this.pSB_Boxes); pUFO.ActivateGameSprite(this.pSB_Aliens); pUFO.animate = true; SwapDirection(); // Attach the missile to the Bomb root GameObject pUFORoot = GameObjectMan.Find(GameObject.Name.UFORoot); Debug.Assert(pUFORoot != null); // Add to GameObject Tree - {update and collisions} pUFORoot.Add(pUFO); // Add timer event UFO Tempo UFOTempoEvent pUFOTempo = new UFOTempoEvent(pUFO); pUFOTempo.Attach(SoundEngine.Name.UFO_HighPitch); TimerMan.Add(TimeEvent.Name.UFOSoundTempo, pUFOTempo, 0.5f); // Add timer event TimerMan.Add(TimeEvent.Name.UFORandom, this, pRandom.Next(8, 25)); // Add timer event for UFO Bombs TimerMan.Add(TimeEvent.Name.BombRandomUFO, new BombSpawnEvent(pRandom, pUFO), pRandom.Next(1, 4)); }
public static Missile ActivateMissile() { ShipMan pShipMan = ShipMan.PrivInstance(); Debug.Assert(pShipMan != null); // copy over safe copy // TODO: This can be cleaned up more... no need to re-calling new() Missile pMissile = new Missile(GameObject.Name.Missile, GameSprite.Name.Missile, 400, 100); pShipMan.pMissile = pMissile; // Attached to SpriteBatches SpriteNodeBatch pSB_Player = SpriteNodeBatchManager.Find(SpriteNodeBatch.Name.Players); SpriteNodeBatch pSB_Boxes = SpriteNodeBatchManager.Find(SpriteNodeBatch.Name.Boxes); pMissile.ActivateCollisionSprite(pSB_Boxes); pMissile.ActivateGameSprite(pSB_Player); // Attach the missile to the missile root GameObject pMissileGroup = GameObjectManager.Find(GameObject.Name.MissileGroup); Debug.Assert(pMissileGroup != null); // Add to GameObject Tree - {update and collisions} pMissileGroup.Add(pShipMan.pMissile); return(pShipMan.pMissile); }
private static Ship ActivateShip() { ShipMan pShipMan = ShipMan.PrivInstance(); Debug.Assert(pShipMan != null); // copy over safe copy Ship pShip = new Ship(GameObject.Name.Ship, GameSprite.Name.Ship, 400, 120); pShipMan.pShip = pShip; // Attach the sprite to the correct sprite batch SpriteNodeBatch pSB_Player = SpriteNodeBatchManager.Find(SpriteNodeBatch.Name.Players); pSB_Player.Attach(pShip.pProxySprite); // Attach the missile to the missile root GameObject pShipRoot = GameObjectManager.Find(GameObject.Name.ShipRoot); Debug.Assert(pShipRoot != null); // Add to GameObject Tree - {update and collisions} pShipRoot.Add(pShipMan.pShip); return(pShipMan.pShip); }
//---------------------------------------------------------------------------------- // Abstract Methods //---------------------------------------------------------------------------------- public override void Execute(float deltaTime) { //Debug.WriteLine("{0}------------- DROPPING BOMB !!!", hash); //Debug.WriteLine("({0}, {1})", this.x, this.y); // Create Bomb int bombType = psRandom.Next(0, 3); Bomb pBomb; if (bombType == 1.0f) { pBomb = new Bomb(GameObject.Name.Bomb, GameSprite.Name.BombZigZag, new FallZigZagStrategy(), this.x, this.y); } else if (bombType == 2.0f) { pBomb = new Bomb(GameObject.Name.Bomb, GameSprite.Name.BombDagger, new FallDaggerStrategy(), this.x, this.y); } else { pBomb = new Bomb(GameObject.Name.Bomb, GameSprite.Name.BombRolling, new FallDaggerStrategy(), this.x, this.y); } pBomb.ActivateCollisionSprite(this.pSB_Boxes); pBomb.ActivateGameSprite(this.pSB_Invaders); // Attach the missile to the Bomb root GameObject pBombRoot = GameObjectManager.Find(GameObject.Name.BombRoot); Debug.Assert(pBombRoot != null); // Add to GameObject Tree - {update and collisions} pBombRoot.Add(pBomb); }
public override void Execute() { // Let the gameObject deal with this... //this.pAlien.Remove(); GameObject pA = (GameObject)this.pUFO; GameObject pB = (GameObject)Iterator.GetParent(pA); pA.Remove(); // TODO: update score - may need a better way (maybe an observer) SceneContext sc = SceneContext.GetInstance(); sc.GetState().UpdateScore(this.pUFO.GetScore()); // TODO: Splat Alien - needs a better way this.pSplat = new Splat(GameObject.Name.Splat, GameSprite.Name.SplatUFO, pUFO.x, pUFO.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.SplatRemoveUFO, new SplatRemoveEvent(this.pSplat), 0.5f); }
private void AttachTo(GameObject pGameObj, GameObject col) { Debug.Assert(pGameObj != null); if (col != null) { col.Add(pGameObj); pGameObj.ActivateGameSprite(this.pSpriteBatch); pGameObj.ActivateCollisionSprite(this.pBoxSpriteBatch); } }
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 void RepopulateUFO() { GameObject pUFOGrid = GameObjectManager.Find(GameObject.Name.UFOGrid); Debug.Assert(pUFOGrid != null); GameObject pBoss = this.Create(GameObject.Name.Saucer, AlienCategory.Type.Saucer, 100.0f, 1100.0f); ((AlienGrid)pUFOGrid).SetMovementTimeInterval(0.5f); pUFOGrid.Add(pBoss); TimerManager.Add(TimeEvent.Name.SpawnUFO, new SpawnUFO((AlienGrid)pUFOGrid), 30.0f); }
public void LoadAll(BirdGrid pGrid) { GameObject pGameObj = null; // Create Column 0 GameObject pCol0 = Create(GameObject.Name.BirdColumn_0, BirdCategory.Type.Column); pGrid.Add(pCol0); pGameObj = Create(GameObject.Name.RedBird, BirdCategory.Type.Red, 250.0f + 50.0f, 400.0f); pCol0.Add(pGameObj); pGameObj = Create(GameObject.Name.YellowBird, BirdCategory.Type.Yellow, 250.0f + 50.0f, 250.0f); pCol0.Add(pGameObj); GameObject pCol1 = Create(GameObject.Name.BirdColumn_1, BirdCategory.Type.Column); pGrid.Add(pCol1); pGameObj = Create(GameObject.Name.GreenBird, BirdCategory.Type.Green, 250.0f + 50.0f, 300.0f); pCol1.Add(pGameObj); pGameObj = Create(GameObject.Name.WhiteBird, BirdCategory.Type.White, 250.0f + 50.0f, 300.0f); pCol1.Add(pGameObj); //pGrid.Print(); //Debug.WriteLine("\n"); //Debug.WriteLine("Iterator...\n"); //ForwardIterator pIt = new ForwardIterator(pGrid); //Component pNode = pIt.First(); //while (!pIt.IsDone()) //{ // pNode.Dump(); // pNode = pIt.Next(); //} }
//---------------------------------------------------------------------------------- // Abstract Methods //---------------------------------------------------------------------------------- public override void Notify() { // Delete missile //Debug.WriteLine("RemoveBombObserver: {0} {1}", this.pSubject.pObjA, this.pSubject.pObjB); // Need to separate out collision-pairs since this class can handle multiple Explosion cases. switch (this.name) { case GameObject.Name.AlienExplosion: this.pTargetObj = this.pSubject.pObjB; break; case GameObject.Name.MissileExplosion: this.pTargetObj = this.pSubject.pObjA; break; case GameObject.Name.BombExplosion: this.pTargetObj = this.pSubject.pObjA; break; default: Debug.WriteLine("There is no Default explosion. Make sure you enter the name you want."); Debug.Assert(false); break; } Debug.Assert(this.pTargetObj != null); float px = this.pTargetObj.x; float py = this.pTargetObj.y; // Factor attaches to the correct sprite batches // Could be an AlienExplosion, BombExplosion, MissileExplosion this.pExplosion = EF.Create(this.name, px, py); // Attach the missile to the missile root GameObject pExplosionRoot = GameObjectManager.Find(GameObject.Name.ExplosionRoot); Debug.Assert(pExplosionRoot != null); // Add to GameObject Tree - {update and collisions} pExplosionRoot.Add(this.pExplosion); // Delay ExplosionObserver pObserver = new ExplosionObserver(this); DelayedObjectManager.Attach(pObserver); }
public static void ActivateMissile() { SpriteBatch pAliensBatch = SpriteBatchManager.Find(SpriteBatch.Name.Aliens); SpriteBatch pBoxBatch = SpriteBatchManager.Find(SpriteBatch.Name.Boxes); GameObject pMissileGroup = GameObjectManager.Find(GameObject.Name.MissileGroup); Debug.Assert(pMissileGroup != null); pMissile.ActivateCollisionSprite(pBoxBatch); pMissile.ActivateGameSprite(pAliensBatch); pMissileGroup.Add(pMissile); }
public static Ship ActivateShip(Ship pShip) { // Attach the sprite to the correct sprite batch SpriteBatch pSB_Aliens = SpriteBatchMan.Find(SpriteBatch.Name.Aliens); pSB_Aliens.Attach(pShip.pProxySprite); GameObject pShipRoot = GameObjectMan.Find(GameObject.Name.ShipRoot); Debug.Assert(pShipRoot != null); // Add to GameObject Tree - {update and collisions} pShipRoot.Add(pShip); return(pShip); }
private GameObject CreateUFOGrid() { //AlienFactory AF = new AlienFactory(SpriteNodeBatch.Name.TheSwarm, SpriteNodeBatch.Name.Boxes); GameObject pUFOGrid = this.Create(GameObject.Name.UFOGrid, AlienCategory.Type.UFOGrid); // Starts off screen then jumps in with spawn timeEvent GameObject pBoss = this.Create(GameObject.Name.Saucer, AlienCategory.Type.Saucer, 100.0f, 1100.0f); ((AlienGrid)pUFOGrid).SetMovementTimeInterval(0.5f); pUFOGrid.Add(pBoss); GameObjectManager.Attach(pUFOGrid); return(pUFOGrid); }
public override void Execute() { // Let the gameObject deal with this... //this.pAlien.Remove(); GameObject pA = (GameObject)this.pAlien; GameObject pB = (GameObject)Iterator.GetParent(pA); pA.Remove(); // TODO: Need a better way... if (privCheckParent(pB) == true) { GameObject pC = (GameObject)Iterator.GetParent(pB); pB.Remove(); if (privCheckParent(pC) == true) { //pC.Remove(); // Recreate Grid on last alien delete AlienGrid pGrid = (AlienGrid)pC; pGrid.GenerateAlien(GameObjectMan.GetActive()); pGrid.ResetSpeed(); this.scenePlay.AddLife(); } } // TODO: update score - may need a better way (maybe an observer) SceneContext sc = SceneContext.GetInstance(); sc.GetState().UpdateScore(this.pAlien.scoreValue); // TODO: Splat Alien - needs a better way this.pSplat = new Splat(GameObject.Name.Splat, GameSprite.Name.SplatAlien, pAlien.x, pAlien.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.SplatRemoveAlien, new SplatRemoveEvent(this.pSplat), 0.5f); }
public static void ActivateShip() { SpriteBatch pAliensBatch = SpriteBatchManager.Find(SpriteBatch.Name.Aliens); SpriteBatch pBoxBatch = SpriteBatchManager.Find(SpriteBatch.Name.Boxes); GameObject pShipRoot = GameObjectManager.Find(GameObject.Name.ShipRoot); Debug.Assert(pShipRoot != null); pShip.pProxySprite.Set(GameSprite.Name.Ship); pShip.poColObj.poColRect.Set(pShip.pProxySprite.pSprite.GetScreenRect()); pShip.ActivateCollisionSprite(pBoxBatch); pShip.ActivateGameSprite(pAliensBatch); pShipRoot.Add(pShip); }