Ejemplo n.º 1
0
 public void UpdateScore()
 {
     foreach (Throw _throw in currentTurn.GetThrows())
     {
         Points += _throw.GetPoint();
     }
 }
Ejemplo n.º 2
0
        private void OnDartBoard_Click(object sender, EventArgs e)
        {
            MouseEventArgs mE            = (MouseEventArgs)e;
            Player         currentPlayer = game.GetCurrentPlayer();
            Turn           currentTurn   = currentPlayer.GetCurrentTurn();

            playerListBox.SelectedIndex = game.GetPlayerlist().IndexOf(currentPlayer);
            if (currentTurn.GetThrowCount() < 3)
            {
                currentTurn.AddThrow(new Throw(mE.Location.X, mE.Location.Y));
                LogWriter.Write(currentPlayer.ToString() + " threw " + currentTurn.GetThrows()[currentTurn.GetThrowCount() - 1].GetPoint());
                if (currentTurn.GetThrowCount() == 3)
                {
                    currentPlayer.UpdateScore();
                    UpdateScoreboard();
                    game.NextPlayer();
                    playerListBox.SelectedIndex = game.GetPlayerlist().IndexOf(game.GetCurrentPlayer());
                }
            }
        }