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); }
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); }
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 override void Transition() { SpriteBatchMan.SetActive(this.poSpriteBatchMan); GameObjectMan.SetActive(this.poGameObjectMan); FontMan.SetActive(this.poFontMan); InputMan.SetActive(this.poInputMan); }
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); }
override public void Execute(float deltaTime) { float value = pRandom.Next(10, 60); UFO pUFO = new UFO(GameObject.Name.UFO, GameSprite.Name.UFO, 100, 515); ColPair pColPair = ColPairMan.Add(ColPair.Name.UFO_WallLeft, pUFO, this.pWallLeft); pColPair.Attach(new UFOWallLeftObserver()); pColPair = ColPairMan.Add(ColPair.Name.UFO_WallRight, pUFO, this.pWallRight); pColPair.Attach(new UFOWallRightObserver()); MissileGroup pMissile = (MissileGroup)GameObjectMan.Find(GameObject.Name.MissileGroup); pColPair = ColPairMan.Add(ColPair.Name.UFOMissile, pUFO, pMissile); pColPair.Attach(new RemoveUFOObserver()); pUFO.ActivateCollisionSprite(this.pSB_Boxes); pUFO.ActivateGameSprite(this.pSB_Aliens); GameObjectMan.Attach(pUFO); Sound.Name pSoundName = Sound.Name.Uninitialized; switch (pRandom.Next(0, 1)) { case (0): pSoundName = Sound.Name.UFOLow; break; case (1): pSoundName = Sound.Name.UFOHigh; break; } SoundMan.PlaySound(pSoundName); TimerMan.Add(TimeEvent.Name.UFO, this, value); }
public static void Update() { //GameObjectMan pMan = GameObjectMan.privGetInstance(); GameObjectMan pMan = GameObjectMan.pActiveGOMan; Debug.Assert(pMan != null); GameObjectNode pGameObjectNode = (GameObjectNode)pMan.baseGetActive(); while (pGameObjectNode != null) { ReverseIterator pRev = new ReverseIterator(pGameObjectNode.pGameObj); Component pNode = pRev.First(); while (!pRev.IsDone()) { GameObject pGameObj = (GameObject)pNode; //Debug.WriteLine("update: {0} ({1})", pGameObj, pGameObj.GetHashCode()); pGameObj.Update(); pNode = pRev.Next(); } pGameObjectNode = (GameObjectNode)pGameObjectNode.pNext; } }
// public public static void Create(int init = 2, int delta = 2) { if (pMan == null) { pMan = new GameObjectMan(init, delta); } }
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 virtual void Remove() { Debug.WriteLine("REMOVE: {0}", this); // Remove from SpriteBatch // Find the SpriteNode Debug.Assert(this.pProxySprite != null); SpriteNode pSpriteNode = this.pProxySprite.GetSpriteNode(); // Remove it from the manager Debug.Assert(pSpriteNode != null); SpriteBatchMan.Remove(pSpriteNode); // Remove collision sprite from spriteBatch Debug.Assert(this.poColObj != null); Debug.Assert(this.poColObj.pColSprite != null); pSpriteNode = this.poColObj.pColSprite.GetSpriteNode(); Debug.Assert(pSpriteNode != null); SpriteBatchMan.Remove(pSpriteNode); // Remove from GameObjectMan GameObjectMan.Remove(this); //GhostMan.Add(this); }
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); } }
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 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); }
override public void Update(float systemTime) { // Snd update - keeps everything moving and updating smoothly sndEngine.Update(); // Single Step, Free running... Simulation.Update(systemTime); // Input InputMan.Update(); // Run based on simulation stepping if (Simulation.GetTimeStep() > 0.0f) { // Fire off the timer events TimerMan.Update(Simulation.GetTotalTime()); // walk through all objects and push to flyweight GameObjectMan.Update(); // Do the collision checks ColPairMan.Process(); // Delete any objects here... DelayedObjectMan.Process(); } }
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 static void Update() { GameObjectMan pMan = GameObjectMan.PrivGetInstance(); Debug.Assert(pMan != null); GameObjectNode pGameObjectNode = (GameObjectNode)pMan.BaseGetActive(); while (pGameObjectNode != null) { //Debug.WriteLine("update: GameObjectTree {0} ({1})", pGameObjectNode.pGameObj, pGameObjectNode.pGameObj.GetHashCode()); //Debug.WriteLine(" +++++"); // Need to rework GameObjectMan to only use Components ReverseIterator pRev = new ReverseIterator(pGameObjectNode.pGameObj); Component pNode = pRev.First(); while (!pRev.IsDone()) { GameObject pGameObj = (GameObject)pNode; pGameObj.Update(); pNode = pRev.Next(); } pGameObjectNode = (GameObjectNode)pGameObjectNode.pNext; } }
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 static void Create(int reserveNum = 3, int reserveGrow = 1) { Debug.Assert(reserveNum > 0); Debug.Assert(reserveGrow > 0); Debug.Assert(pInstance == null); pInstance = new GameObjectMan(reserveNum, reserveGrow); }
public static void Remove(GameObject pNode) { // Keenan(delete.E) Debug.Assert(pNode != null); //GameObjectMan pMan = GameObjectMan.privGetInstance(); GameObjectMan pMan = GameObjectMan.pActiveGOMan; GameObject pSafetyNode = pNode; // OK so we have a linked list of trees (Remember that) // 1) find the tree root (we already know its the most parent) GameObject pTmp = pNode; GameObject pRoot = null; while (pTmp != null) { pRoot = pTmp; pTmp = (GameObject)Iterator.GetParent(pTmp); } // 2) pRoot is the tree we are looking for // now walk the active list looking for pRoot GameObjectNode pTree = (GameObjectNode)pMan.baseGetActive(); while (pTree != null) { if (pTree.pGameObj == pRoot) { // found it break; } // Goto Next tree pTree = (GameObjectNode)pTree.pNext; } // 3) pTree is the tree that holds pNode // Now remove the node from that tree //Debug.Assert(pTree != null); //Debug.Assert(pTree.pGameObj != null); // Is pTree.poGameObj same as the node we are trying to delete? // Answer: should be no... since we always have a group (that was a good idea) //Debug.Assert(pTree.pGameObj != pNode); GameObject pParent = (GameObject)Iterator.GetParent(pNode); Debug.Assert(pParent != null); GameObject pChild = (GameObject)Iterator.GetChild(pNode); Debug.Assert(pChild == null); // remove the node pParent.Remove(pNode); // TODO - Recycle pNode }
public static void InitializeGrid() { // get Alien Grid From ReservedChildren Group AliensGrid Grid = (AliensGrid)GameObjectMan.Find(0, 0).GameObj; //if Grid has Child in the object pool DLinkedNode Col = Grid.Reservedchildren.GetHead(); if (Col != null) { ResetGrid(Grid); // Update xs and ys of the whole grid UpdateGridPos(60, 530 - 30 * Nums.Level); // next line is necessary PlayBatchMan.Find(BatchName.Box).Add(GetGrid().CollisionObj.Box); } else { // if Aliens Grid is not in the object pool. create new Grid Obj for (int j = 1; j <= 11; j++) { Composite col = AlienObjectFactory.CreatComposite(j); Grid.Add(col); } } _AlienGridMan._AlienGrid = Grid; }
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 static void Update() { //ensure call Create() first GameObjectMan pMan = GameObjectMan.GetInstance(); Debug.Assert(pMan != null); GameObjectNode pGameObjectNode = (GameObjectNode)pMan.baseGetActiveList(); while (pGameObjectNode != null) { ReverseIterator pRev = new ReverseIterator(pGameObjectNode.getGameObject()); Component pNode = pRev.first(); while (!pRev.isDone()) { GameObject pGameObj = (GameObject)pNode; pGameObj.update(); pNode = pRev.next(); } pGameObjectNode = (GameObjectNode)pGameObjectNode.pNext; } }
public static Missile ActivateMissile() { ShipMan pShipMan = ShipMan.PrivInstance(); Debug.Assert(pShipMan != null); // copy over safe copy // 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 SpriteBatch pSB_Aliens = instance.pSpriteBatchMan.Find(SpriteBatch.Name.Aliens); SpriteBatch pSB_Boxes = instance.pSpriteBatchMan.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 static void Reset() { //ensure call Create() first GameObjectMan pMan = GameObjectMan.GetInstance(); Debug.Assert(pMan != null); GameObjectNode pGameObjectNode = (GameObjectNode)pMan.baseGetActiveList(); while (pGameObjectNode != null) { Component pGameObject = (Component)pGameObjectNode.getGameObject(); while (pGameObject.holder == Component.Container.Composite) { Composite pComposite = (Composite)pGameObject; pGameObject = (Component)pComposite.poHead; pComposite.poHead = null; pComposite.poLast = null; if (pGameObject == null || pGameObject.holder == Component.Container.Leaf) { break; } } pGameObjectNode = (GameObjectNode)pGameObjectNode.pNext; } }
public virtual void Remove() { // Very difficult at first... if you are messy, you will pay here! // Given a game object.... // Remove from SpriteBatch // Find the SBNode Debug.Assert(this.pProxySprite != null); SBNode pSBNode = this.pProxySprite.GetSBNode(); // Remove it from the manager Debug.Assert(pSBNode != null); SpriteBatchMan.Remove(pSBNode); // Remove collision sprite from spriteBatch Debug.Assert(this.poColObj != null); Debug.Assert(this.poColObj.pColSprite != null); pSBNode = this.poColObj.pColSprite.GetSBNode(); Debug.Assert(pSBNode != null); SpriteBatchMan.Remove(pSBNode); // Remove from GameObjectMan GameObjectMan.Remove(this); //GhostMan.Add(this); }
public static void InitializeBomb(float x, float y) { // get Bomb Group BombCol BCol = (BombCol)GameObjectMan.Find(0, 10).GameObj; // if bullet is in the object pool if (BCol.Reservedchildren.GetHead() != null) { _BombMan.Bomb = (BombLeaf)BCol.Reservedchildren.GetHead(); BCol.Reservedchildren.Remove(_BombMan.Bomb); UpdateBombPos(x, y); _BombMan.Bomb.ResetStrategy(); // next line is necessary PlayBatchMan.Find(BatchName.Box).Add(GetBomb().CollisionObj.Box); PlayBatchMan.Find(BatchName.Box).Add(BCol.CollisionObj.Box); } else // if bullet is not in the object pool. create new Bullet Obj { GetRandomBomb(); UpdateBombPos(x, y); } BCol.Add(GetBomb()); }
public static void ChangeSceneInternal(GameObject pGameObject) { ForwardIterator pFor = new ForwardIterator(pGameObject); Component pNode = pFor.First(); pFor.Next(); if (pFor.IsDone()) { GameObject pUFORoot = GameObjectMan.Find(GameObject.Name.UFORoot); UFO pUFO = (UFO)Iterator.GetChild(pUFORoot); pUFO.StopSound(); int mode = SceneStateGame.GetPlayMode(); int currLevel = SceneStateGame.GetCurrLevel(); String pScore1 = Int32.Parse(FontMan.Find(Font.Name.Score1).GetMessage()).ToString().PadLeft(4, '0'); SceneStateGame.SetScore1(pScore1); String pScore2 = Int32.Parse(FontMan.Find(Font.Name.Score2).GetMessage()).ToString().PadLeft(4, '0'); SceneStateGame.SetScore2(pScore2); String pScoreHigh = Int32.Parse(FontMan.Find(Font.Name.ScoreHigh).GetMessage()).ToString().PadLeft(4, '0'); SceneStateGame.SetScoreHigh(pScoreHigh); SceneStateGame.SetStay(true); int currPlayer = SceneStateGame.GetCurrPlayer(); if (currLevel == 1) { SceneStateGame.SetPlayerLevel(currPlayer, 2); SceneStateGame.SetBaseY(450.0f); SceneStateGame.SetMoveRate(1.0f); } else { SceneStateGame.SetPlayerLevel(currPlayer, 1); SceneStateGame.SetBaseY(600.0f); SceneStateGame.SetMoveRate(1.5f); //no need to change to the next player, when finish level 2, same player, back to level 1 //SceneStateGame.SetCurrPlayer(currPlayer == mode ? 1 : 2); } //currLevel = SceneStateGame.GetCurrLevel(); //if (currLevel == 1) //{ // SceneStateGame.SetBaseY(600.0f); // SceneStateGame.SetMoveRate(1.5f); //} //else //{ // SceneStateGame.SetBaseY(450.0f); // SceneStateGame.SetMoveRate(1.0f); //} Scene pScene = SceneMan.GetScene(); pScene.Unload(); } }
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); }
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 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); }