Example #1
0
        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());
        }
Example #2
0
        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());
        }
Example #3
0
        public override void Update()
        {
            int lives = ScoreManager.UpdateLives();

            if (lives == 0)
            {
                Debug.WriteLine("Game Over!");
            }
            else
            {
                PCSTree     pRootTree = GameObjectManager.GetRootTree();
                SpriteBatch sbBoxes   = SpriteBatchManager.Find(SpriteBatchName.Boxes);
                SpriteBatch sbAliens  = SpriteBatchManager.Find(SpriteBatchName.Aliens);
                //MissileRoot pMissileRoot = new MissileRoot(GameObjectName.MissileRoot, SpriteBaseName.Null, 0.0f, 0.0f, 0);
                //pMissileRoot.ActivateCollisionSprite(sbBoxes);
                ShipRoot pShipRoot = (ShipRoot)GameObjectManager.Find(GameObjectName.ShipRoot);
                pShipRoot.ActivateCollisionSprite(sbBoxes);
                pShipRoot.ActivateGameSprite(sbAliens);
                ShipManager.Create();
                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;
                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, 1.0f, 1.0f, new BombSpawnEvent(pGrid));
            }
        }