예제 #1
0
        public gamePhase HandleInput(ButtonEvents bEvent, gamePhase same, UFOManager ufo, Player player)
        {
            gamePhase result = same;

            if (bEvent.BackPress || bEvent.EscPress)
            {
                // Allows the game to exit
                result = gamePhase.QUIT;
            }
            else if (bEvent.DpadDownPress || bEvent.DownPress)
            {
                // Move difficulty selector down
                difficulty.option = (difficulty.option + 1) % 3;
            }
            else if (bEvent.DpadUpPress || bEvent.UpPress)
            {
                // Move difficulty selector up
                difficulty.option = (difficulty.option + 2) % 3;
            }
            else if (bEvent.StartPress || bEvent.EnterPress)
            {
                // Begin game
                switch (difficulty.option)
                {
                case 0:     //Easy
                    player.level       = 1;
                    player.score       = 0;
                    player.lives       = 10;
                    player.maxBullets  = 8;
                    player.bulletSpeed = 3;
                    player.setSpeedMultiplier(8);
                    break;

                case 1:     //Medium
                    player.level       = 1;
                    player.score       = 0;
                    player.lives       = 5;
                    player.maxBullets  = 2;
                    player.bulletSpeed = 1.5f;
                    player.setSpeedMultiplier(5);
                    break;

                case 2:     //Hard
                    player.level       = 1;
                    player.score       = 0;
                    player.lives       = 3;
                    player.maxBullets  = 1;
                    player.bulletSpeed = 1;
                    player.setSpeedMultiplier(3);
                    break;
                }
                ufo.Destroy();
                result     = gamePhase.LOADLEVEL;
                mFirstPass = true;         //reset splash screen initializer
            }

            return(result);
        }
예제 #2
0
 public void Initialize(Player player, AlienManager aliens, UFOManager ufo)
 {
     if (mTimer == 0)
     {
         player.bullets().Clear();
         aliens.Clear();
         ufo.Destroy();
         aliens.Spawn(player.level);
     }
 }