public static void InitializeTimerManager() { Grid pGrid = (Grid)GameObjectManager.Find(GameObjectName.Grid); float marchSpeed = pGrid.marchSpeed; AnimationSprite animSpriteSquids = new AnimationSprite(SpriteBaseName.Squid); animSpriteSquids.Attach(ImageName.SquidA); animSpriteSquids.Attach(ImageName.SquidB); AnimationSprite animSpriteCrabs = new AnimationSprite(SpriteBaseName.Crab); animSpriteCrabs.Attach(ImageName.CrabA); animSpriteCrabs.Attach(ImageName.CrabB); AnimationSprite animSpriteOctopi = new AnimationSprite(SpriteBaseName.Octopus); animSpriteOctopi.Attach(ImageName.OctopusA); animSpriteOctopi.Attach(ImageName.OctopusB); SoundCommand playFastInvader1 = new SoundCommand(SoundName.fastInvader1); SoundCommand playFastInvader2 = new SoundCommand(SoundName.fastInvader2); SoundCommand playFastInvader3 = new SoundCommand(SoundName.fastInvader3); SoundCommand playFastInvader4 = new SoundCommand(SoundName.fastInvader4); TimerManager.Add(TimerEventName.MoveGrid, GetCurrentTime() + marchSpeed, marchSpeed, new MoveGridEvent()); TimerManager.Add(TimerEventName.AnimateSquids, GetCurrentTime() + marchSpeed, marchSpeed, animSpriteSquids); TimerManager.Add(TimerEventName.AnimateCrabs, GetCurrentTime() + marchSpeed, marchSpeed, animSpriteCrabs); TimerManager.Add(TimerEventName.AnimateOctopi, GetCurrentTime() + marchSpeed, marchSpeed, animSpriteOctopi); TimerManager.Add(TimerEventName.PlayFastInvaders4, GetCurrentTime() + marchSpeed, 4 * marchSpeed, playFastInvader4); TimerManager.Add(TimerEventName.PlayFastInvaders1, GetCurrentTime() + 2 * marchSpeed, 4 * marchSpeed, playFastInvader1); TimerManager.Add(TimerEventName.PlayFastInvaders2, GetCurrentTime() + 3 * marchSpeed, 4 * marchSpeed, playFastInvader2); TimerManager.Add(TimerEventName.PlayFastInvaders3, GetCurrentTime() + 4 * marchSpeed, 4 * marchSpeed, playFastInvader3); TimerManager.Add(TimerEventName.BombSpawn, GetCurrentTime() + marchSpeed, pGrid.bombFrequency, new BombSpawnEvent(pGrid)); TimerManager.Add(TimerEventName.UFOSpawn, GetCurrentTime() + (float)random.Next(5, 10), (float)random.Next(5, 10), new UFOSpawnEvent()); }
public override void Update() { if (GameManager.GetGame().GetState() is GameActiveState) { GameObject ship = ShipManager.GetShip(); if (ship != null) { ship.Remove(); GameObject pShipRoot = GameObjectManager.Find(GameObjectName.ShipRoot); pShipRoot.Remove(); } Alien pExplosion = new Explosion(GameObjectName.Explosion, SpriteBaseName.Explosion, AlienType.Explosion, ship, ColorName.Green, 0); SpriteBatch sbAliens = SpriteBatchManager.Find(SpriteBatchName.Aliens); SpriteBatch sbBoxes = SpriteBatchManager.Find(SpriteBatchName.Boxes); pExplosion.ActivateGameSprite(sbAliens); pExplosion.ActivateCollisionSprite(sbBoxes); GameObjectManager.AttachTree(pExplosion); Game pGame = GameManager.GetGame(); pGame.roundNum = 1; ScoreManager.ClearLives(); TimerManager.ClearTimerManager(); pExplosion.Remove(); pGame.Die(); TimerManager.Add(TimerEventName.GameStart, TimerManager.GetCurrentTime() + 10.0f, 10.0f, new GameStartEvent(pGame)); } }
public static Missile ActivateMissile() { ShipManager shipMan = ShipManager.GetInstance(); PCSTree pcsTree = GameObjectManager.GetRootTree(); Debug.Assert(pcsTree != null); Missile pMissile = new Missile(GameObjectName.Missile, SpriteBaseName.Missile, 400.0f, 100.0f, 0); pMissile.pProxySprite.pSprite.SetColor(ColorFactory.Create(ColorName.Green).pAzulColor); shipMan.pMissile = pMissile; SpriteBatch sbAliens = SpriteBatchManager.Find(SpriteBatchName.Aliens); SpriteBatch sbBoxes = SpriteBatchManager.Find(SpriteBatchName.Boxes); pMissile.ActivateCollisionSprite(sbBoxes); pMissile.ActivateGameSprite(sbAliens); GameObject pMissileRoot = GameObjectManager.Find(GameObjectName.MissileRoot); Debug.Assert(pMissileRoot != null); pcsTree.Insert(shipMan.pMissile, pMissileRoot); return(shipMan.pMissile); }
public static Ship ActivateShip(bool isCollisionBoxActive) { ShipManager shipMan = ShipManager.GetInstance(); PCSTree pcsTree = GameObjectManager.GetRootTree(); Debug.Assert(pcsTree != null); Ship pShip = new Ship(GameObjectName.Ship, SpriteBaseName.Ship, 150.0f, 100.0f); shipMan.pShip = pShip; SpriteBatch sbAliens = SpriteBatchManager.Find(SpriteBatchName.Aliens); SpriteBatch sbBoxes = SpriteBatchManager.Find(SpriteBatchName.Boxes); if (isCollisionBoxActive) { pShip.ActivateCollisionSprite(sbBoxes); } pShip.ActivateGameSprite(sbAliens); //sbAliens.Attach(pShip.pProxySprite); GameObject pShipRoot = GameObjectManager.Find(GameObjectName.ShipRoot); Debug.Assert(pShipRoot != null); pShip.Update(); pcsTree.Insert(shipMan.pShip, pShipRoot); return(shipMan.pShip); }
// Should be called at some point before leaving state public override void CleanUp(GameManager pGameManager) { //Debug.WriteLine("Cleaning up Attract Screen and Preparing to leave"); // Clear text before leaving select screen FontManager.Remove(FontManager.Find(Font.Name.Play)); FontManager.Remove(FontManager.Find(Font.Name.SpaceInvader)); FontManager.Remove(FontManager.Find(Font.Name.ScoringTable)); FontManager.Remove(FontManager.Find(Font.Name.ScoreMystery)); FontManager.Remove(FontManager.Find(Font.Name.ScoreSmInvader)); FontManager.Remove(FontManager.Find(Font.Name.ScoreMedInvader)); FontManager.Remove(FontManager.Find(Font.Name.ScoreLgInvader)); FontManager.Remove(FontManager.Find(Font.Name.PressSpace)); GameObject pGameObj = GameObjectManager.Find(GameObject.Name.UFO); pGameObj.Remove(); pGameObj = GameObjectManager.Find(GameObject.Name.SmallInvader); pGameObj.Remove(); pGameObj = GameObjectManager.Find(GameObject.Name.MediumInvader); pGameObj.Remove(); pGameObj = GameObjectManager.Find(GameObject.Name.LargeInvader); pGameObj.Remove(); InputSubject pInputSubject = InputManager.GetSpaceSubject(); pInputSubject.PurgeAll(); Handle(pGameManager); }
public static void DropBomb() { UFOManager ufoMan = UFOManager.GetInstance(); UFO ufo = ufoMan.pUFO; PCSTree pcsTree = GameObjectManager.GetRootTree(); Debug.Assert(pcsTree != null); Bomb pBomb = new Bomb(GameObjectName.UFOBomb, SpriteBaseName.UFOBomb, new FallStraight(), ufo.x, ufo.y, 0); pBomb.pProxySprite.pSprite.SetColor(ColorFactory.Create(ColorName.Red).pAzulColor); ufoMan.pBomb = pBomb; SpriteBatch sbAliens = SpriteBatchManager.Find(SpriteBatchName.Aliens); SpriteBatch sbBoxes = SpriteBatchManager.Find(SpriteBatchName.Boxes); pBomb.ActivateCollisionSprite(sbBoxes); pBomb.ActivateGameSprite(sbAliens); GameObject pBombRoot = GameObjectManager.Find(GameObjectName.BombRoot); Debug.Assert(pBombRoot != null); pcsTree.Insert(ufoMan.pBomb, pBombRoot); SetUFOBombActive(true); Debug.WriteLine("UFO Bomb dropped!"); }
public static Missile ActivateMissile() { ShipManager pShipMan = ShipManager.privInstance(); Debug.Assert(pShipMan != null); // get the game object tree PCSTree pTree = GameObjectManager.GetRootTree(); Debug.Assert(pTree != null); //create a new missile!! // copy over safe copy (create a new one or find in game object tree) Missile pMissile = new Missile(GameObject.Name.Missile, GameSprite.Name.Missile, 0, 400, 100); pShipMan.pMissile = pMissile; // Attach missile to SpriteBatches SpriteBatch pSB_Aliens = SpriteBatchManager.Find(SpriteBatch.Name.GameSprites); SpriteBatch pSB_Boxes = SpriteBatchManager.Find(SpriteBatch.Name.SpriteBoxes); pMissile.ActivateCollisionSprite(pSB_Boxes); pMissile.ActivateGameSprite(pSB_Aliens); // Attach the missile to the missile root GameObject pMissileRoot = GameObjectManager.Find(GameObject.Name.MissileRoot); Debug.Assert(pMissileRoot != null); // Add to GameObject Tree - {update and collisions} pTree.Insert(pShipMan.pMissile, pMissileRoot); return(pShipMan.pMissile); }
public override void execute(float currentTime) { AnimationSprite animSpriteSquids = new AnimationSprite(SpriteBaseName.Squid); animSpriteSquids.Attach(ImageName.SquidA); animSpriteSquids.Attach(ImageName.SquidB); AnimationSprite animSpriteCrabs = new AnimationSprite(SpriteBaseName.Crab); animSpriteCrabs.Attach(ImageName.CrabA); animSpriteCrabs.Attach(ImageName.CrabB); AnimationSprite animSpriteOctopi = new AnimationSprite(SpriteBaseName.Octopus); animSpriteOctopi.Attach(ImageName.OctopusA); animSpriteOctopi.Attach(ImageName.OctopusB); SoundCommand playFastInvader1 = new SoundCommand(SoundName.fastInvader1); SoundCommand playFastInvader2 = new SoundCommand(SoundName.fastInvader2); SoundCommand playFastInvader3 = new SoundCommand(SoundName.fastInvader3); SoundCommand playFastInvader4 = new SoundCommand(SoundName.fastInvader4); Grid pGrid = (Grid)GameObjectManager.Find(GameObjectName.Grid); float marchSpeed = pGrid.marchSpeed; float bombFrequency = pGrid.bombFrequency; TimerManager.Dump(); TimerManager.Add(TimerEventName.MoveGrid, marchSpeed, marchSpeed, new MoveGridEvent()); TimerManager.Add(TimerEventName.AnimateSquids, marchSpeed, marchSpeed, animSpriteSquids); TimerManager.Add(TimerEventName.AnimateCrabs, marchSpeed, marchSpeed, animSpriteCrabs); TimerManager.Add(TimerEventName.AnimateOctopi, marchSpeed, marchSpeed, animSpriteOctopi); TimerManager.Add(TimerEventName.PlayFastInvaders4, marchSpeed, 4 * marchSpeed, playFastInvader4); TimerManager.Add(TimerEventName.PlayFastInvaders1, 2 * marchSpeed, 4 * marchSpeed, playFastInvader1); TimerManager.Add(TimerEventName.PlayFastInvaders2, 3 * marchSpeed, 4 * marchSpeed, playFastInvader2); TimerManager.Add(TimerEventName.PlayFastInvaders3, 4 * marchSpeed, 4 * marchSpeed, playFastInvader3); TimerManager.Add(TimerEventName.BombSpawn, bombFrequency, bombFrequency, new BombSpawnEvent(pGrid)); TimerManager.Add(TimerEventName.UFOSpawn, TimerManager.GetCurrentTime() + (float)UFOManager.GetRandom().Next(5, 10), (float)UFOManager.GetRandom().Next(5, 10), new UFOSpawnEvent()); }
//---------------------------------------------------------------------------------- // 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); }
//called from column ( (GameObject)this.pParent ); public override void DropBomb() { float bomb_startPosX = this.x; float bomb_startPosY = this.y; //Bomb pBomb = new Bomb(GameObject.Name.Bomb, GameSprite.Name.CrossAlienBomb, new FallStraight(), 0, bomb_startPosX, bomb_startPosY); //Debug.Assert(pBomb != null); Random r = new Random(); int randomBombType = r.Next(1, 4); Bomb pBomb = privCreateBomb(randomBombType, bomb_startPosX, bomb_startPosY); //get the root tree PCSTree rootGamObjTree = GameObjectManager.GetRootTree(); Debug.Assert(rootGamObjTree != null); //find the bomb root GameObject pBombRoot = GameObjectManager.Find(GameObject.Name.BombRoot); Debug.Assert(pBombRoot != null); rootGamObjTree.Insert(pBomb, pBombRoot); //activate the sprites SpriteBatch pSB_GameSprites = SpriteBatchManager.Find(SpriteBatch.Name.GameSprites); SpriteBatch pSB_Boxes = SpriteBatchManager.Find(SpriteBatch.Name.SpriteBoxes); pBomb.ActivateGameSprite(pSB_GameSprites); pBomb.ActivateCollisionSprite(pSB_Boxes); }
public override void Update(float systemTime) { InputManager.Update(); FontManager.Update(Font.Name.Player1Score, SpaceInvaders.pPlayer1Score); FontManager.Update(Font.Name.Player2Score, SpaceInvaders.pPlayer2Score); FontManager.Update(Font.Name.HiScore, SpaceInvaders.pHiScore); FontManager.Update(Font.Name.Lives, ScenePlay.ShipLives.ToString()); this.RunTime = Simulation.GetTotalTime() - ScenePlay.StartTimeDelta; //Debug.WriteLine(this.RunTime); TimerManager.Update(this.RunTime); GameObjectManager.Update(); //Collision Checks CollisionPairManager.Process(); // Delete any objects here... DelayedObjectManager.Process(); //check if all alien killed AlienGrid pGrid = (AlienGrid)GameObjectManager.Find(GameObject.Name.AlienGrid); if (pGrid.GetAlienCount() < 1) { pGrid.IncreaseStartRate(); this.ResetAll(); } }
public static UFO ActivateUFO(bool isCollisionBoxActive) { Debug.WriteLine("UFO has been activated!"); UFOManager ufoMan = UFOManager.GetInstance(); PCSTree pcsTree = GameObjectManager.GetRootTree(); Debug.Assert(pcsTree != null); UFOStrategy strat = new UFOMoveRight(); float x = -10.0f; if (pRandom.Next(0, 2) == 0) { strat = new UFOMoveLeft(); x = 915.0f; } UFO pUFO = new UFO(GameObjectName.UFO, SpriteBaseName.UFO, strat, x, 905.0f); ufoMan.pUFO = pUFO; UFORoot pUFORoot = (UFORoot)GameObjectManager.Find(GameObjectName.UFORoot); SpriteBatch sbAliens = SpriteBatchManager.Find(SpriteBatchName.Aliens); SpriteBatch sbBoxes = SpriteBatchManager.Find(SpriteBatchName.Boxes); if (isCollisionBoxActive) { pUFO.ActivateCollisionSprite(sbBoxes); } pUFO.ActivateGameSprite(sbAliens); pcsTree.Insert(ufoMan.pUFO, pUFORoot); SetUFOActive(true); return(ufoMan.pUFO); }
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); }
public static void ResetAlienPoints(float offY = 0.0f) { GameObject pGroup = GameObjectManager.Find(GameObject.Name.AlienGroup); GameObject pColumn = Iterator.GetChildGameObject(pGroup); float offset = Constant.ALIEN_OFFSET_X; int i = 0; while (pColumn != null) { GameObject pAlien = Iterator.GetChildGameObject(pColumn); pAlien.x = 100.0f + offset * i; pAlien.y = Constant.WINDOW_HEIGHT - 200.0f - offY; pAlien = (GameObject)pAlien.pNext; pAlien.x = 100.0f + offset * i; pAlien.y = Constant.WINDOW_HEIGHT - 240.0f - offY; pAlien = (GameObject)pAlien.pNext; pAlien.x = 100.0f + offset * i; pAlien.y = Constant.WINDOW_HEIGHT - 280.0f - offY; pAlien = (GameObject)pAlien.pNext; pAlien.x = 100.0f + offset * i; pAlien.y = Constant.WINDOW_HEIGHT - 320.0f - offY; pAlien = (GameObject)pAlien.pNext; pAlien.x = 100.0f + offset * i; pAlien.y = Constant.WINDOW_HEIGHT - 360.0f - offY; i++; pColumn = (GameObject)pColumn.pNext; } }
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); }
public UFOFlyingSoundEvent() { this.pSound = SoundManager.Find(Sound.Name.UFO); UFORoot pRoot = (UFORoot)GameObjectManager.Find(GameObject.Name.UFORoot); this.pUFO = (OrangeSaucer)pRoot.GetFirstChild(); }
public override void Update() { GameObject pSplat = GameObjectManager.Find(GameObjectName.Splat); if (pSplat.markedForDeath == false) { pSplat.markedForDeath = true; RemoveSplatObserver pObserver = new RemoveSplatObserver(pSplat); DelayedGameObjectManager.Attach(pObserver); } }
public override void Update() { GameObject pExplosion = GameObjectManager.Find(this.goName); if (pExplosion.markedForDeath == false) { pExplosion.markedForDeath = true; RemoveExplosionObserver pObserver = new RemoveExplosionObserver(pExplosion); DelayedGameObjectManager.Attach(pObserver); } }
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 override void Execute(float deltaTime) { Debug.Assert(this.pAlien != null); this.pAlien.Remove(); if (this.pAlien.name != GameObject.Name.OrangeSaucer) { AlienGrid pGrid = (AlienGrid)GameObjectManager.Find(GameObject.Name.AlienGrid); Debug.Assert(pGrid != null); pGrid.DecreaseAlienCount(); } }
private void privTestAlienColumnBombDrop() { //TEST - drop bomb on trigger; //get the grid as a game object GameObject gridGameObj = GameObjectManager.Find(GameObject.Name.Grid); //cast to an alien to drop the bomb AlienType alienGrid = (AlienType)gridGameObj; //drop the bomb - function cascades to first child of first column alienGrid.DropBomb(); }
public static void ClearGameScreen() { // Remove Bombs GameObject bombRoot = GameObjectManager.Find(GameObjectName.BombRoot); PCSTreeReverseIterator iterBomb = new PCSTreeReverseIterator(bombRoot); GameObject pGoBomb = (GameObject)iterBomb.First(); while (!iterBomb.IsDone()) { pGoBomb.Remove(); pGoBomb = (GameObject)iterBomb.Next(); } Missile pMissile = ShipManager.GetMissile(); if (pMissile != null && pMissile.enabled) { pMissile.Remove(); } // Remove Shields for (int i = 1; i < 5; ++i) { GameObject shieldRoot = GameObjectManager.Find(GameObjectName.ShieldRoot, i); PCSTreeReverseIterator iter = new PCSTreeReverseIterator(shieldRoot); GameObject pGO = (GameObject)iter.First(); while (!iter.IsDone()) { pGO.Remove(); pGO = (GameObject)iter.Next(); } } // Remove Alien Grid GameObject grid = GameObjectManager.Find(GameObjectName.Grid); PCSTreeReverseIterator iterGrid = new PCSTreeReverseIterator(grid); GameObject pGameObj = (GameObject)iterGrid.First(); while (!iterGrid.IsDone()) { pGameObj.Remove(); pGameObj = (GameObject)iterGrid.Next(); } // Remove CollisionBoxes if (GameManager.GetCollisionBoxes()) { GameObject pWallRoot = GameObjectManager.Find(GameObjectName.WallRoot); PCSTreeReverseIterator iterWall = new PCSTreeReverseIterator(pWallRoot); GameObject pGO = (GameObject)iterWall.First(); while (!iterWall.IsDone()) { pGO.Remove(); pGO = (GameObject)iterWall.Next(); } } }
public BombSpawnEvent(Grid pGrid) { this.pBombRoot = GameObjectManager.Find(GameObjectName.BombRoot); Debug.Assert(this.pBombRoot != null); this.sbAliens = SpriteBatchManager.Find(SpriteBatchName.Aliens); Debug.Assert(sbAliens != null); this.sbBoxes = SpriteBatchManager.Find(SpriteBatchName.Boxes); Debug.Assert(sbBoxes != null); this.pGrid = pGrid; }
//---------------------------------------------------------------------------------- // Constructor //---------------------------------------------------------------------------------- public MissileSpawnEvent(Random pRandom) { this.pMissileRoot = GameObjectManager.Find(GameObject.Name.MissileGroup); Debug.Assert(this.pMissileRoot != null); this.pSB_Invaders = SpriteNodeBatchManager.Find(SpriteNodeBatch.Name.TheSwarm); Debug.Assert(this.pSB_Invaders != null); this.pSB_Boxes = SpriteNodeBatchManager.Find(SpriteNodeBatch.Name.Boxes); Debug.Assert(this.pSB_Boxes != null); this.pRandom = pRandom; }
public static void RemoveBombs() { BombGroup pGroup = (BombGroup)GameObjectManager.Find(GameObject.Name.BombGroup); Bomb pBomb = (Bomb)pGroup.poHead; Bomb pNextBomb; while (pBomb != null) { pNextBomb = (Bomb)pBomb.pNext; BombManager.DeactiveBomb(pBomb); pBomb = pNextBomb; } }
public override void Execute(float deltaTime) { float NewTime = RandomManager.RandomInt(45, 61); UFORoot pUFORoot = (UFORoot)GameObjectManager.Find(GameObject.Name.UFORoot); OrangeSaucer pUFO = (OrangeSaucer)pUFORoot.GetFirstChild(); pUFO.RandomizeDirection(); // Add itself back to timer TimerManager.Add(TimeEvent.Name.UFOSpawn, this, NewTime); TimerManager.Add(TimeEvent.Name.PlayUFOSound, this.pSoundEvent, 0.17f); }
//---------------------------------------------------------------------------------- // 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 void RepopulateGrid() { GameObject pSwarmGrid = GameObjectManager.Find(GameObject.Name.AlienGrid); // Set the initial speed float speed = 0.8f - 0.06f * Level.GetCurrentLevel(); ((AlienGrid)pSwarmGrid).movementTimeInterval = speed; GameObject pCol0 = this.Create(GameObject.Name.Column_0, AlienCategory.Type.Column); GameObject pCol1 = this.Create(GameObject.Name.Column_1, AlienCategory.Type.Column); GameObject pCol2 = this.Create(GameObject.Name.Column_2, AlienCategory.Type.Column); GameObject pCol3 = this.Create(GameObject.Name.Column_3, AlienCategory.Type.Column); GameObject pCol4 = this.Create(GameObject.Name.Column_4, AlienCategory.Type.Column); GameObject pCol5 = this.Create(GameObject.Name.Column_5, AlienCategory.Type.Column); GameObject pCol6 = this.Create(GameObject.Name.Column_6, AlienCategory.Type.Column); GameObject pCol7 = this.Create(GameObject.Name.Column_7, AlienCategory.Type.Column); GameObject pCol8 = this.Create(GameObject.Name.Column_8, AlienCategory.Type.Column); GameObject pCol9 = this.Create(GameObject.Name.Column_9, AlienCategory.Type.Column); GameObject pCol10 = this.Create(GameObject.Name.Column_10, AlienCategory.Type.Column); float ititHeight = 800.0f; float start_x = 100.0f; float w = 70.0f; FillSwarmColumn(pCol0, start_x, ititHeight); FillSwarmColumn(pCol1, start_x + 1.0f * w, ititHeight); FillSwarmColumn(pCol2, start_x + 2.0f * w, ititHeight); FillSwarmColumn(pCol3, start_x + 3.0f * w, ititHeight); FillSwarmColumn(pCol4, start_x + 4.0f * w, ititHeight); FillSwarmColumn(pCol5, start_x + 5.0f * w, ititHeight); FillSwarmColumn(pCol6, start_x + 6.0f * w, ititHeight); FillSwarmColumn(pCol7, start_x + 7.0f * w, ititHeight); FillSwarmColumn(pCol8, start_x + 8.0f * w, ititHeight); FillSwarmColumn(pCol9, start_x + 9.0f * w, ititHeight); FillSwarmColumn(pCol10, start_x + 10.0f * w, ititHeight); pSwarmGrid.Add(pCol0); pSwarmGrid.Add(pCol1); pSwarmGrid.Add(pCol2); pSwarmGrid.Add(pCol3); pSwarmGrid.Add(pCol4); pSwarmGrid.Add(pCol5); pSwarmGrid.Add(pCol6); pSwarmGrid.Add(pCol7); pSwarmGrid.Add(pCol8); pSwarmGrid.Add(pCol9); pSwarmGrid.Add(pCol10); }
public override void Notify() { //-------RemoveLife------- ScenePlay.ShipLives--; this.count++; PlayerLivesComposite pNullObjs = (PlayerLivesComposite)GameObjectManager.Find(GameObject.Name.Null_Object); pNullObjs.RemoveLife(count); if (this.count > 2) { this.count = 1; } }