private void OnPlayerTurnEnded(PlayerTurn sender, EventArgs e) { if (PlayerTurnEnd != null) { PlayerTurnEnd(sender, e); } }
public void NewPlayerTurn() { var pt = new PlayerTurn(_players[_currentPlayerTurnIndex]); pt.TurnStarted += OnPlayerTurnStarted; pt.TurnEnded += OnPlayerTurnEnd; pt.FinishedRolls += OnPlayerFinishesRolls; _playerTurns[_currentPlayerTurnIndex] = pt; pt.Start(); }
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(); } }
private void OnPlayerTurnStarted(PlayerTurn sender, EventArgs e) { Console.WriteLine(sender.Player.Name + " started turn."); PlayerTurnStarted?.Invoke(sender, EventArgs.Empty); }
private void OnPlayerFinishesRolls(PlayerTurn sender, EventArgs e) { Console.WriteLine("Player " + sender.Player.Name + " finished rolls."); }