Beispiel #1
0
 /// <summary>
 /// Interakcja - ladowanie okna + zdarzenia (sygnaly od wciskanych przyciskow)
 /// </summary>
 private void UserControl_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.Up && _directionY != 10)
     {
         _directionX = 0;
         _directionY = -10;
     }
     if (e.Key == Key.Down && _directionY != -10)
     {
         _directionX = 0;
         _directionY = 10;
     }
     if (e.Key == Key.Left && _directionX != 10)
     {
         _directionX = -10;
         _directionY = 0;
     }
     if (e.Key == Key.Right && _directionX != -10)
     {
         _directionX = 10;
         _directionY = 0;
     }
     if (e.Key == Key.P)
     {
         Timer.Stop();
         GameMusic.Pause();
         var messageBoxResult = WpfMessageBox.Show("Pause!", "Game paused", MessageBoxButton.OKCancel, WpfMessageBox.MessageBoxImage.Pause);
     }
     // ten if jest dla testow:
     if (e.Key == Key.G)
     {
         _tmpForTest = true;
     }
 }