private void OnPreviewKeyDown(object sender, KeyEventArgs e) { switch (e.Key) { case Key.A: case Key.Left: // left if (IsMoveAllowed(0, -5)) { Camera1.MoveLeft(5); LogCommandText("Camera1.MoveLeft(5);"); e.Handled = true; } break; case Key.D: case Key.Right: // right if (IsMoveAllowed(0, 5)) { Camera1.MoveRight(5); LogCommandText("Camera1.MoveRight(5);"); e.Handled = true; } break; case Key.W: case Key.Up: // forward if (IsMoveAllowed(10, 0)) { Camera1.MoveForward(10); LogCommandText("Camera1.MoveForward(10);"); e.Handled = true; } break; case Key.S: case Key.Down: // backward if (IsMoveAllowed(-10, 0)) { Camera1.MoveBackward(10); LogCommandText("Camera1.MoveBackward(10);"); e.Handled = true; } break; } }
private void OnPreviewKeyDown(object sender, KeyEventArgs e) { switch (e.Key) { case Key.A: case Key.Left: // left Camera1.MoveLeft(5); e.Handled = true; break; case Key.D: case Key.Right: // right Camera1.MoveRight(5); e.Handled = true; break; case Key.W: case Key.Up: // forward Camera1.MoveForward(10); e.Handled = true; break; case Key.S: case Key.Down: // backward Camera1.MoveBackward(10); e.Handled = true; break; } }