Example #1
0
 private void OnPlayerTurnEnded(PlayerTurn sender, EventArgs e)
 {
     if (PlayerTurnEnd != null)
     {
         PlayerTurnEnd(sender, e);
     }
 }
Example #2
0
        public void NewPlayerTurn()
        {
            var pt = new PlayerTurn(_players[_currentPlayerTurnIndex]);

            pt.TurnStarted   += OnPlayerTurnStarted;
            pt.TurnEnded     += OnPlayerTurnEnd;
            pt.FinishedRolls += OnPlayerFinishesRolls;
            _playerTurns[_currentPlayerTurnIndex] = pt;
            pt.Start();
        }
Example #3
0
        private void OnPlayerTurnEnd(PlayerTurn sender, EventArgs e)
        {
            Console.WriteLine(sender.Player.Name + " ended turn.");

            PlayerTurnEnd?.Invoke(sender, e);

            if (++_currentPlayerTurnIndex == _players.Count)
            {
                End();
            }
            else
            {
                NewPlayerTurn();
            }
        }
Example #4
0
        private void OnPlayerTurnStarted(PlayerTurn sender, EventArgs e)
        {
            Console.WriteLine(sender.Player.Name + " started turn.");

            PlayerTurnStarted?.Invoke(sender, EventArgs.Empty);
        }
Example #5
0
 private void OnPlayerFinishesRolls(PlayerTurn sender, EventArgs e)
 {
     Console.WriteLine("Player " + sender.Player.Name + " finished rolls.");
 }