Пример #1
0
 private void CaptureKeyDown(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.Left)
     {
         _game.ChangeDirection(Direction.Left);
     }
     else if (e.Key == Key.Right)
     {
         _game.ChangeDirection(Direction.Right);
     }
     else if (e.Key == Key.Up)
     {
         _game.ChangeDirection(Direction.Up);
     }
     else if (e.Key == Key.Down)
     {
         _game.ChangeDirection(Direction.Down);
     }
     else if (e.Key == Key.Enter)
     {
         _game.Player.AddSnakePart(Direction.Right);
     }
 }