/// <summary> /// Gets called when the game field is clicked. Occurs only if a ball is in the senders window /// </summary> /// <param name="sender">The sender.</param> /// <param name="args">The <see cref="GameFieldClickedEventArgs"/> instance containing the event data.</param> private void GameFieldClicked(object sender, GameFieldClickedEventArgs args) { var ballPosition = this.CurrentGame.CurrentBallPosition; var direction = new Vector(args.MousePosition.X, args.MousePosition.Y) - new Vector(ballPosition.X, ballPosition.Y); // The ball has to move into the opposite direction direction.Negate(); this.gameController.StartRound(direction); }
/// <summary> /// Called when the game field is clicked. /// </summary> /// <param name="mousePosition">The mouse position.</param> private void OnGameFieldClicked(Point mousePosition) { var eventArgs = new GameFieldClickedEventArgs(mousePosition); this.GameFieldClicked(this, eventArgs); }