public void RemovePlayer(NetworkPlayer player) { players.playerCounter--; Player playerToRemove = players.GetPlayer(player); playerToRemove.Pass(); Money betOfPlayerToRemove = playerToRemove.GetBet(); mainPile += betOfPlayerToRemove; network.SetPile(mainPile.ToString()); List <Card> takeCards = playerToRemove.takeCards(); if (takeCards.Count > 0) { mainDeck.Add(takeCards); } if (players.Count < 3) { players.Remove(playerToRemove); allowNewGame = false; if (gameRunning) { TakeBets(); EndGame(players[0]); counter = TimerOff; ui.ClearUI(); } } else { if (UnityEngine.Object.Equals(players.actual, playerToRemove)) { if (players.NextPlayer()) { players.Remove(playerToRemove); network.PlayerActivate(players.actual); } else { players.Remove(playerToRemove); EndTurn(); } } else { players.Remove(playerToRemove); Player winner = players.ThereIsWinner(); if (winner != null) { EndGame(winner); } } } }