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 Notify() { TimeEvent pMoveGrid = TimerMan.Find(TimeEvent.Name.MoveGrid); pMoveGrid.deltaTime -= 0.009f; TimeEvent pSwapAliens = TimerMan.Find(TimeEvent.Name.SwapAliens); pSwapAliens.deltaTime -= 0.009f; TimeEvent pGridSoundTempo = TimerMan.Find(TimeEvent.Name.GridSoundTempo); pGridSoundTempo.deltaTime -= 0.009f; }
public void nextLevel() { this.level++; GameObject pGameObjCol; // store columns GameObject.Name[] columns = { GameObject.Name.AlienColumn_0, GameObject.Name.AlienColumn_1, GameObject.Name.AlienColumn_2, GameObject.Name.AlienColumn_3, GameObject.Name.AlienColumn_4, GameObject.Name.AlienColumn_5, GameObject.Name.AlienColumn_6, GameObject.Name.AlienColumn_7, GameObject.Name.AlienColumn_8, GameObject.Name.AlienColumn_9, GameObject.Name.AlienColumn_10 }; AlienFactory alienFactory = new AlienFactory(SpriteBatch.Name.Aliens, SpriteBatch.Name.Boxes); for (int i = 0; i < 11; i++) { // create column and add to column composite pGameObjCol = alienFactory.create(columns[i], AlienCategory.Type.Column); // add children to children composite pGameObjCol.add(alienFactory.create(GameObject.Name.Squid, AlienCategory.Type.Squid, 80.0f + 40 * i, 850.0f)); pGameObjCol.add(alienFactory.create(GameObject.Name.Crab, AlienCategory.Type.Crab, 80.0f + 40 * i, 800.0f)); pGameObjCol.add(alienFactory.create(GameObject.Name.Crab, AlienCategory.Type.Crab, 80.0f + 40 * i, 750.0f)); pGameObjCol.add(alienFactory.create(GameObject.Name.Octopus, AlienCategory.Type.Octopus, 80.0f + 40 * i, 700.0f)); pGameObjCol.add(alienFactory.create(GameObject.Name.Octopus, AlienCategory.Type.Octopus, 80.0f + 40 * i, 650.0f)); // add column to alien group composite this.add(pGameObjCol); } if (level > 1) { this.deltaX = 10 * (level - 1); this.deltaX += this.speedUp; this.goingDown = false; this.moveForward = true; TimeEvent pTimeEvent = TimerMan.Find(TimeEvent.Name.SquidAnimation); pTimeEvent.setDeltaTime(0.75f); pTimeEvent = TimerMan.Find(TimeEvent.Name.OctopusAnimation); pTimeEvent.setDeltaTime(0.75f); pTimeEvent = TimerMan.Find(TimeEvent.Name.CrabAnimation); pTimeEvent.setDeltaTime(0.75f); } }
public void addDifficult() { TimeEvent pTimeEvent = TimerMan.Find(TimeEvent.Name.SquidAnimation); float currDelta = pTimeEvent.getDeltaTime(); pTimeEvent.setDeltaTime(currDelta - 0.15f); pTimeEvent = TimerMan.Find(TimeEvent.Name.OctopusAnimation); currDelta = pTimeEvent.getDeltaTime(); pTimeEvent.setDeltaTime(currDelta - 0.15f); pTimeEvent = TimerMan.Find(TimeEvent.Name.CrabAnimation); currDelta = pTimeEvent.getDeltaTime(); pTimeEvent.setDeltaTime(currDelta - 0.15f); this.deltaX++; }
public void ResetSpeed() { this.delta = 7.0f; this.orgTime -= 0.01f; TimeEvent pMoveGrid = TimerMan.Find(TimeEvent.Name.MoveGrid); pMoveGrid.deltaTime = orgTime; TimeEvent pSwapAliens = TimerMan.Find(TimeEvent.Name.SwapAliens); pSwapAliens.deltaTime = orgTime; TimeEvent pGridSoundTempo = TimerMan.Find(TimeEvent.Name.GridSoundTempo); pGridSoundTempo.deltaTime = orgTime; }
public override void Notify() { //might need to specify if i add more sound effects //but testing here TimeEvent pTE = TimerMan.Find(TimeEvent.Name.PlaySound); if (pTE != null) { TimerMan.Remove(pTE); } else { // edge case of ufo hit wall and hit by missile //event was attempted to be removed twice } //TimerMan.DumpTimeEvents(); }
public override void Notify() { this.pBomb = (Bomb)this.pSubject.pObjA; MissileGroup pMissileGroup = (MissileGroup)this.pSubject.pObjB; this.pMissile = (Missile)Iterator.GetChild(pMissileGroup); Debug.Assert(this.pMissile != null); if (this.pBomb.bMarkForDeath == false) { this.pBomb.bMarkForDeath = true; } if (this.pMissile.bMarkForDeath == false) { this.pBomb.bMarkForDeath = true; } // Delay RemoveMissileAndBombObserver pObserver = new RemoveMissileAndBombObserver((Bomb)this.pBomb, (Missile)this.pMissile); DelayedObjectMan.Attach(pObserver); //--------------------------------------------------------------------------------------------------------- // Sound //--------------------------------------------------------------------------------------------------------- SoundMan.PlaySound(Sound.Name.InvaderKilled); TimeEvent pTimeEvent = TimerMan.Find(TimeEvent.Name.ScenePlaySound); //--------------------------------------------------------------------------------------------------------- // Explosion //--------------------------------------------------------------------------------------------------------- Explosion explosion = new Explosion(GameObject.Name.Explosion, GameSprite.Name.Explosion, 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 pA = (GameObject)this.pAlien; GameObject pB = (GameObject)Iterator.GetParent(pA); float x = this.pAlien.x; float y = this.pAlien.y; AlienGrid pGrid = (AlienGrid)this.pAlien.pParent.pParent; pGrid.nNumActive--; 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(); } } Missile pMissile = (Missile)this.pGameObj; Player pPlayer = pMissile.pPlayer; // Font.Name pFontName = Font.Name.Uninitialized; if (this.pGameObj is MissileCategory) { pPlayer.nPoints += this.pAlien.GetPoints(); Font pScore = null; if (pPlayer.n == 1) { pScore = FontMan.Find(Font.Name.Score1Value); pFontName = Font.Name.Score1Value; } if (pPlayer.n == 2) { pScore = FontMan.Find(Font.Name.Score2Value); pFontName = Font.Name.Score2Value; } pScore.Set(pFontName, pPlayer.nPoints.ToString(), Glyph.Name.Consolas20pt, pScore.pFontSprite.x, pScore.pFontSprite.y); } //--------------------------------------------------------------------------------------------------------- // Sound //--------------------------------------------------------------------------------------------------------- SoundMan.PlaySound(Sound.Name.InvaderKilled); TimeEvent pTimeEvent = TimerMan.Find(TimeEvent.Name.ScenePlaySound); pTimeEvent.deltaTime -= 0.01f; //--------------------------------------------------------------------------------------------------------- // Explosion //--------------------------------------------------------------------------------------------------------- Explosion explosion = new Explosion(GameObject.Name.Explosion, GameSprite.Name.Explosion, x, 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); //--------------------------------------------------------------------------------------------------------- // Scene Transition //--------------------------------------------------------------------------------------------------------- if (pGrid.nNumActive == 0 && pPlayer.nCurrLevel == 1) { PlayerMan.WriteHighScores(); pPlayer.nCurrLevel++; SceneContext.GetState().Initialize(); if (SceneContext.bMultiplayer) { SceneContext.SetState(SceneContext.Scene.MultiPlay); } else { SceneContext.SetState(SceneContext.Scene.SinglePlay); } } else if (pGrid.nNumActive == 0 && pPlayer.nCurrLevel == 2) { PlayerMan.WriteHighScores(); SceneContext.SetState(SceneContext.Scene.Credits); } }
public override void LoadContent() { //make the next wave more difficult //change grid movement speed and add more bombs GraveyardMan.RaiseDead(); //can be finicky might need to replace //GraveyardMan.RebuildShields(); //------------------------------------------------------------------------------------------------------- //create factory //-------------------------------------------------------------------------------------------------------- Composite pAlienGroup = (Composite)GONodeMan.Find(GameObject.Name.AlienGrid); //AlienFactory AF = new AlienFactory(SpriteBatch.Name.Aliens, SpriteBatch.Name.Boxes, pAlienGroup); //GameObject pGameObj; //AF.SetParent(pAlienGroup); //GameObject pCol = AF.Create(GameObject.Name.Column_1, AlienCategory.Type.Column, 0.0f, 0.0f); //AF.SetParent(pCol); //pGameObj = AF.Create(GameObject.Name.Octopus, AlienCategory.Type.Octopus, 70.0f, 600); //Column Creation 1 - 11 //for (int i = 0; i < 1; i++) //{ // AF.SetParent(pAlienGroup); // GameObject pCol = AF.Create(GameObject.Name.Column_1 + i, AlienCategory.Type.Column, 0.0f, 0.0f, i); // AF.SetParent(pCol); // pGameObj = AF.Create(GameObject.Name.Octopus, AlienCategory.Type.Octopus, 70.0f + i * 43.0f, 660); // pGameObj = AF.Create(GameObject.Name.Crab, AlienCategory.Type.Crab, 70.0f + i * 43.0f, 620); // pGameObj = AF.Create(GameObject.Name.Crab, AlienCategory.Type.Crab, 70.0f + i * 43.0f, 580); // pGameObj = AF.Create(GameObject.Name.Squid, AlienCategory.Type.Squid, 70.0f + i * 43.0f, 540); // pGameObj = AF.Create(GameObject.Name.Squid, AlienCategory.Type.Squid, 70.0f + i * 43.0f, 500); //} //Debug.WriteLine("-------------------"); //pAlienGroup.Print(); //--------------------------------------------------------------------------------------------------------- // Shields //--------------------------------------------------------------------------------------------------------- //float posX = 80; //float posY = 120; //for (int i = 0; i < 1; i++) //{ // ShieldFactory.ShieldCreator(posX, posY, GameObject.Name.ShieldGrid_1 + i); // posX += 130; //} //Debug.WriteLine("-------------------"); //GameObject pShieldRoot = GONodeMan.Find(GameObject.Name.ShieldRoot); //pShieldRoot.Print(); //--------------------------------------------------------------------------------- //Event/Difficulty Modifiers //---------------------------------------------------------------------------------- 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); pE1.SetTriggerTime(0.50f); pE2.SetTriggerTime(0.50f); pE3.SetTriggerTime(0.50f); pE4.SetTriggerTime(0.50f); //pAlienGroup.SetDeltaMove(18.0f); BombDrop pBombDrop1 = new BombDrop((AlienGroup)pAlienGroup); BombDrop pBombDrop2 = new BombDrop((AlienGroup)pAlienGroup); BombDrop pBombDrop3 = new BombDrop((AlienGroup)pAlienGroup); TimerMan.Add(TimeEvent.Name.ColumnShoot, pBombDrop1, 1.0f); TimerMan.Add(TimeEvent.Name.ColumnShoot, pBombDrop2, 3.0f); TimerMan.Add(TimeEvent.Name.ColumnShoot, pBombDrop3, 5.0f); }