private void Rebet() { ReturnCards(); dealer.ClearHand(); dealer.Initialize(startingPlayerCash.Value); for (int i = 0; i < players.Length; i++) { if (players[i].scorerData.hands == null || players[i].scorerData.hands.Count == 0) { continue; } players[i].ClearHand(); players[i].Initialize(players[i].scorerData.cash); } if (deck.GetCardCount() < 52) { stateMachine.SwitchTo(GameState.Shuffle); } else { stateMachine.SwitchTo(GameState.Betting); } }
/// <summary> /// Resets the blackjacktable /// </summary> public void ResetTable() { isRoundPlaying = false; //Reset the dealer dealer.ClearHand(); //Combine the lists and clear bustedPlayers players.AddRange(bustedPlayers); players.AddRange(playersToJoin); bustedPlayers.Clear(); playersToJoin.Clear(); //Lets re-sort the list so all players are in order players = players.OrderBy(p => p.Position).ToList(); //This is working because the list IS sorted. //Reset all players foreach (Player player in players) { player.ClearHand(); player.Joined = true; player.MyTurn = false; } }