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); } }
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() { this.pUFO.remove(); UFOEvent pUFOEvent = new UFOEvent(); TimerMan.Add(TimeEvent.Name.MovementAnimation, pUFOEvent, UFOMan.getDeltaTime()); }
public override void execute() { this.pBomb.getProxySprite().setGameSprite(GameSpriteMan.Find(GameSprite.Name.Bomb_Explosion)); ExplosionEvent pExplosionEvent = new ExplosionEvent(this.pBomb); TimerMan.Add(TimeEvent.Name.ExplosionEvent, pExplosionEvent, 0.1f); }
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 Execute() { GameObject pAlienObject = (GameObject)this.pAlien; GameObject pColumn = (GameObject)Iterator.GetParent(pAlienObject); SpaceInvaders pGame = GameMan.GetGame(); //always remove the alien pAlienObject.Remove(); //check if Column has aliens left //true means we have no more children, and safe to remove column if (PrivCheckParent(pColumn) == true) { GameObject pGroup = (GameObject)Iterator.GetParent(pColumn); pColumn.Remove(); //check if Grid/Group had any columns left //true means we have no more children, and safe to change states if (PrivCheckParent(pGroup) == true) { //We just beat a wave, so call the the states handle // to either go to next wave or to see if its the end of the game TimerMan.Add(TimeEvent.Name.GameStateChange, new GameStateChange(true), 5.0f); } } }
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); }
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 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(float deltaTime, TimeEvent.Name name) { GameObject pUFO = null; switch (this.flag) { case false: pUFO = new LeftUFO(gameObjectName, spriteName, 800, 600); this.flag = true; break; case true: pUFO = new RightUFO(gameObjectName, spriteName, 100, 600); this.flag = false; break; default: // something is wrong Debug.Assert(false); break; } this.pTree.Add(pUFO); // Attached to Group pUFO.ActivateGameSprite(this.pSpriteBatch); pUFO.ActivateCollisionSprite(this.pCollisionSpriteBatch); Random rnd = new Random(); int num = rnd.Next(20, 50); TimerMan.Add(name, this, num); }
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(); } }
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)); }
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 override void Execute(float deltaTime) { this.pGrid.MoveGrid(); // Add itself back to timer TimerMan.Add(TimeEvent.Name.MoveGrid, this, deltaTime); }
public override void Execute(float deltaTime) { Debug.WriteLine(" {0} time:{1} ", this.pString, TimerMan.GetCurrTime()); // Add itself back to timer TimerMan.Add(TimeEvent.Name.RepeatSample, this, this.repeatDelta); }
public override void Execute(float deltaTime, bool repeat) { ImageHolder pImageHolder = (ImageHolder)SLink.GetNext(this.pCurrImage); if (pImageHolder == null) { pImageHolder = (ImageHolder)poHeadImage; } this.pCurrImage = pImageHolder; this.pSprite.SwapImage(pImageHolder.GetpImange()); if (repeat == true) { if (pSprite.name == GameSprite.Name.Squid) { TimerMan.Add(TimerEvent.Name.SquidAnimation, this, deltaTime); } else if (pSprite.name == GameSprite.Name.Crab) { TimerMan.Add(TimerEvent.Name.CrabAnimation, this, deltaTime); } else if (pSprite.name == GameSprite.Name.Octopus) { TimerMan.Add(TimerEvent.Name.OctopusAnimation, this, deltaTime); } else if (pSprite.name == GameSprite.Name.ShipDies) { TimerMan.Add(TimerEvent.Name.AnimShip, this, deltaTime); } } }
public override void execute(float deltaTime) { UFOMan.ActiveUFO(); SoundMan.Play("ufo_lowpitch.wav"); UfOBomb pUFOBomb = new UfOBomb(); TimerMan.Add(TimeEvent.Name.UFOBombAnination, pUFOBomb, UFOMan.getShootTime()); }
//---------------------------------------------------------------------- // Override Abstract methods //---------------------------------------------------------------------- public override void execute(float deltaTime) { // move the grid ((AlienGroup)this.pGameObj).MoveGrid(); // add itself back to TimerMan TimerMan.Add(TimeEvent.Name.MovementAnimation, this, deltaTime); }
//---------------------------------------------------------------------- // Override Abstract methods //---------------------------------------------------------------------- public override void execute(float deltaTime) { // move the grid ((AlienGroup)this.pGameObj).dropBomb(); // add itself back to TimerMan TimerMan.Add(TimeEvent.Name.DropBombAnination, this, deltaTime); }
// need to test this public override void Execute(float deltaTime) { AlienColumn pSafety = (AlienColumn)Iterator.GetChild(this.pAlienGroup); if (pSafety != null) { AlienColumn pNode = pSafety; Random rNum = new Random(); float ColNum = rNum.Next(0, 11); int count = 0; while (pNode != null) { //check to shoot bomb if (pNode.GetColIndex() == ColNum) { float minX = pNode.GetColObject().poColRect.minX; float minY = pNode.GetColObject().poColRect.minY; pNode.ActivateBomb(minX, minY); TimerMan.Add(TimeEvent.Name.ColumnShoot, this, deltaTime); break; } //might get some random or extra bomb drops if (ColNum == count) { float minX = pNode.GetColObject().poColRect.minX; float minY = pNode.GetColObject().poColRect.minY; pNode.ActivateBomb(minX, minY); TimerMan.Add(TimeEvent.Name.ColumnShoot, this, deltaTime); break; } //at the last node and its not the column to shoot bomb if (pNode.pNext == null && pNode.GetColIndex() != ColNum) { //go back to the front of the list pNode = pSafety; count++; continue; } pNode = (AlienColumn)pNode.pNext; count++; } } else { // do nothing } }
public override void Execute(float deltaTime) { //1 Grid //11 columns //55 aliens //-------- //67 total TimeEvent pE1 = TimerMan.Find(TimeEvent.Name.AnimateSquid); TimeEvent pE2 = TimerMan.Find(TimeEvent.Name.AnimateOcto); TimeEvent pE3 = TimerMan.Find(TimeEvent.Name.AnimateCrab); TimeEvent pE4 = TimerMan.Find(TimeEvent.Name.MoveGrid); ForwardIterator pForIter = new ForwardIterator(pGrid); Component pNode = pForIter.First(); int count = 0; while (!pForIter.IsDone()) { count++; pNode = pForIter.Next(); } // 50 - 35 if (count < 50 && count >= 35) { pE1.SetTriggerTime(0.4f); pE2.SetTriggerTime(0.4f); pE3.SetTriggerTime(0.4f); pE4.SetTriggerTime(0.4f); } //34-15 else if (count < 35 && count >= 15) { pE1.SetTriggerTime(0.20f); pE2.SetTriggerTime(0.20f); pE3.SetTriggerTime(0.20f); pE4.SetTriggerTime(0.20f); } //15-0 else if (count < 15) { pE1.SetTriggerTime(0.10f); pE2.SetTriggerTime(0.10f); pE3.SetTriggerTime(0.10f); pE4.SetTriggerTime(0.10f); } TimerMan.Add(TimeEvent.Name.SpeedCheck, this, deltaTime); }
public override void Execute(float deltaTime) { ActivateUFO(); IrrKlang.ISoundEngine pSndEngine = GameMan.GetGame().GetSndEngine(); pSndEngine.Play2D("ufo_lowpitch.wav"); TimerMan.Add(TimeEvent.Name.SendUFO, this, deltaTime); TimerMan.Add(TimeEvent.Name.UFOBomb, new UFOBombDrop(this.pUFO), 1.0f); TimerMan.Add(TimeEvent.Name.PlaySound, new UFOSound(), 1.5f); }
public override void Notify() { if (scenePlay.numLives > 1) { TimerMan.Add(TimeEvent.Name.RecreateShip, new ReCreateShipEvent(), 0.7f); } else { SceneContext sc = SceneContext.GetInstance(); sc.UpdateScreens(); } }
//this is hopefully going to sound of every 1 second not sure if thats what its supposed to do public override void Execute(float deltaTime) { SpaceInvaders pGame = GameMan.GetGame(); IrrKlang.ISoundEngine pSndEngine = pGame.GetSndEngine(); pSndEngine.SoundVolume = 0.1f; pSndEngine.Play2D("ufo_lowpitch.wav"); TimerMan.Add(TimeEvent.Name.PlaySound, this, deltaTime); }
public override void Execute(float deltaTime) { SoundHolder pSoundHolder = (SoundHolder)this.pCurrSound.pSNext; if (pSoundHolder == null) { pSoundHolder = (SoundHolder)poFirstSound; } this.pCurrSound = pSoundHolder; SoundMan.PlaySound(pSoundHolder.pSound.name); TimerMan.Add(TimeEvent.Name.ScenePlaySound, this, deltaTime); }
public override void Execute() { AnimationSprite pAnimShip = new AnimationSprite(GameSprite.Name.ShipDies); pAnimShip.Attach(Image.Name.ShipDiesB); pAnimShip.Attach(Image.Name.ShipDiesA); TimerMan.Add(TimerEvent.Name.AnimShip, pAnimShip, 0.1f, true); RemoveSprite pAnimGameObjDies = new RemoveSprite(this.pGameObj); TimerMan.Add(TimerEvent.Name.Explosion, pAnimGameObjDies, 0.3f, false); }
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); }
//Grid Observer only worryies about moving the grid back and forth and down public override void Notify() { float movement; //Debug.WriteLine("Grid_Observer: {0} {1}", this.pSubject.pObjA, this.pSubject.pObjB); AlienGroup pGrid = (AlienGroup)this.pSubject.pObjA; WallCategory pWall = (WallCategory)this.pSubject.pObjB; if (pWall.GetCategoryType() == WallCategory.Type.Right) { //BAD HACK FIX LATER movement = pGrid.GetDeltaMove() * -1.0f; pGrid.SetDeltaMove(movement); pGrid.MoveAcross(); pGrid.MoveDown(); } else if (pWall.GetCategoryType() == WallCategory.Type.Left) { movement = pGrid.GetDeltaMove() * -1.0f; pGrid.SetDeltaMove(movement); pGrid.MoveAcross(); pGrid.MoveDown(); } else { //Bottom Wall hit, move aliens up and reset Waves before Game Over SpaceInvaders pGame = GameMan.GetGame(); GameState pState = pGame.GetCurrentState(); if (pState.GetStateName() == GameMan.State.InGame) { InGameState pLvl1 = (InGameState)pState; pLvl1.SetStateToggle(false); TimerMan.Add(TimeEvent.Name.GameStateChange, new GameStateChange(false), 2.0f); } else if (pState.GetStateName() == GameMan.State.LVL2) { InGameStateLV2 pLvl2 = (InGameStateLV2)pState; pLvl2.SetStateToggle(false); TimerMan.Add(TimeEvent.Name.GameStateChange, new GameStateChange(false), 2.0f); } } }
public override void execute() { Ship pRealShip = (Ship)this.pShip; pRealShip.setState(ShipMan.State.End); pRealShip.setPositionState(ShipMan.State.Stay); pRealShip.getProxySprite().setGameSprite(GameSpriteMan.Find(GameSprite.Name.Ship_Explosion1)); AnimationExplosion pAnimExplosion = new AnimationExplosion(pRealShip, 1.0f); pAnimExplosion.attach(Image.Name.Ship_Explosion2); pAnimExplosion.attach(Image.Name.Ship_Explosion1); TimerMan.Add(TimeEvent.Name.ExplosionEvent, pAnimExplosion, 0.3f); //this.pShip.remove(); }
public override void Execute(float deltaTime, bool repeat) { PositionHoder pPositionHoder = (PositionHoder)SLink.GetNext(this.pCurr); if (pPositionHoder == null) { pPositionHoder = (PositionHoder)poHead; } this.pCurr = pPositionHoder; this.pSprites.Move(pPositionHoder.GetPositionX(), pPositionHoder.GetPositionY()); pPositionHoder.GetSnd().Notify(); TimerMan.Add(TimerEvent.Name.AlienMovement, this, deltaTime); }