public void SwitchTurn() { _timer.Enabled = false; _timer.Stop(); IPlayer old_player = DiceEngine.CurrentPlayer; DiceEngine.SwitchTurnToNextPlayer(); DiceEngine.CurrentPlayerTurnScore = 0; TurnSwitched?.Invoke( this, new TurnSwitchedEventArgs(old_player, DiceEngine.CurrentPlayer) ); var all_dice = DiceEngine.AllDice; DiceEngine.DeselectAll(); DiceEngine.Reroll(all_dice); DiceRerolled?.Invoke( this, new RerollEventArgs(all_dice) ); _timer.Stop(); _timer.Start(); _timer.Enabled = true; }
public void StartFirstTurn(IPlayer first_player = null) { if (first_player == null) { first_player = Players.First(); } DiceEngine.SwitchTurnTo(first_player); DiceEngine.CurrentPlayerTurnScore = 0; TurnSwitched?.Invoke( this, new TurnSwitchedEventArgs(null, first_player) ); DiceEngine.Reroll(DiceEngine.AllDice); if (DiceEngine.IsCurrentDiceFailure()) { TurnFailure?.Invoke( this, new PlayerStateEventArgs(first_player) ); } _timer.Enabled = true; _timer.Start(); }