Exemple #1
0
        public void SwitchPlayer()
        {
            if (CurrentGamePhase == GamePhase.ShipPlacement)
            {
                currentPlayer.sea.Enabled = false;
            }
            else
            {
                currentPlayer.sea.Enabled = true;
            }

            if (currentPlayer == p1)
            {
                currentPlayer = p2;
            }
            else
            {
                currentPlayer = p1;
            }

            if (CurrentGamePhase == GamePhase.ShipPlacement)
            {
                currentPlayer.sea.Enabled = true;
            }
            else
            {
                currentPlayer.sea.Enabled = false;
            }

            PlayerSwitched?.Invoke();
        }
 private void OnPlayerSwitched()
 {
     if (PlayerSwitched != null)
     {
         PlayerSwitched.Invoke();
         ContinueToNextEventInQueue();
     }
 }
Exemple #3
0
 public void InvokePlayerSwitched(Player previousPlayer, Player nextPlayer) =>
 PlayerSwitched?.Invoke(new PlayerSwitchedEvent(game, previousPlayer, nextPlayer));