/// <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); } }
/// <summary> /// The ProcessKeyboardEvent method is called to process a keyboard event. /// </summary> /// <param name="direction"></param> public void ProcessKeyboardEvent(Direction direction) { TheSnake.SetSnakeDirection(direction); }
public static void InitGame() { GameBoard.BuildBoard(); TheSnake.MoveSnake(); }