Ejemplo n.º 1
0
 private void OnPlayerTurnEnded(PlayerTurn sender, EventArgs e)
 {
     if (PlayerTurnEnd != null)
     {
         PlayerTurnEnd(sender, e);
     }
 }
Ejemplo n.º 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();
        }
Ejemplo n.º 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();
            }
        }
Ejemplo n.º 4
0
        private void OnPlayerTurnStarted(PlayerTurn sender, EventArgs e)
        {
            Console.WriteLine(sender.Player.Name + " started turn.");

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