Esempio n. 1
0
        public void TestNagivate()
        {
            GameBoard     gb = new GameBoard();
            PlayerVehicle p  = new PlayerVehicle(415, 570);

            ScoreBoard.Initialize(0, 0, 1, "Peak Hours");
            //right
            p.SpeedX = 10000;
            p.SpeedY = 10000;
            SwinGame.Delay(20);
            p.UpdateTime();
            p.NavigateRight();
            Assert.AreEqual(GameController.startLane3X + 20, p.X);
        }
Esempio n. 2
0
 public override void HandleInput()
 {
     if (UtilityFunction.gameStateStack.Peek() == GameState.ViewingGamePage)
     {
         p.UpdateTime();
         if (SwinGame.KeyDown(KeyCode.vk_LEFT))
         {
             p.NavigateLeft();
         }
         else if (SwinGame.KeyDown(KeyCode.vk_RIGHT))
         {
             p.NavigateRight();
         }
         if (SwinGame.KeyDown(KeyCode.vk_UP))
         {
             p.NavigateUp();
         }
         else if (SwinGame.KeyDown(KeyCode.vk_DOWN))
         {
             p.NavigateDown();
         }
     }
     if (UtilityFunction.gameStateStack.Peek() == GameState.GameOverPage)
     {
         if (SwinGame.KeyTyped(KeyCode.vk_y))
         {
             UtilityFunction.gameStateStack.Pop();
         }
         else if (SwinGame.KeyTyped(KeyCode.vk_n))
         {
             while (UtilityFunction.gameStateStack.Peek() != GameState.ViewingMainPage)
             {
                 UtilityFunction.gameStateStack.Pop();
             }
         }
     }
     if (SwinGame.KeyTyped(KeyCode.vk_ESCAPE))
     {
         while (UtilityFunction.gameStateStack.Peek() != GameState.ViewingMainPage)
         {
             UtilityFunction.gameStateStack.Pop();
         }
     }
 }