コード例 #1
0
ファイル: SnakeGame.cs プロジェクト: prbasha/SnakeUWP
 /// <summary>
 /// The GameTimerEventHandler method is called to update the game.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void GameTimerEventHandler(object sender, object e)
 {
     if (IsGameOver)
     {
         // Game over.
         if (_gameTimer.IsEnabled)
         {
             _gameTimer.Stop();  // Stop the game timer.
             RestartGame();      // Restart the game.
         }
     }
     else
     {
         // Game running.
         TheSnake.UpdateSnakeStatus(TheCherry);
     }
 }
コード例 #2
0
ファイル: SnakeGame.cs プロジェクト: prbasha/SnakeUWP
 /// <summary>
 /// The ProcessKeyboardEvent method is called to process a keyboard event.
 /// </summary>
 /// <param name="direction"></param>
 public void ProcessKeyboardEvent(Direction direction)
 {
     TheSnake.SetSnakeDirection(direction);
 }
コード例 #3
0
ファイル: Game.cs プロジェクト: carolinahagman/snake
 public static void InitGame()
 {
     GameBoard.BuildBoard();
     TheSnake.MoveSnake();
 }