public void UpdateState(float deltaTime) { // Check to see who won dealer.DetermineResults(); for (int i = 0; i < dealer.DealerIndex; i++) { foreach (var hand in dealer.players[i].GetComponent <PlayerController>()._hands) { switch (hand.Result) { case Result.BLACKJACK: case Result.WIN: PlayerWins(i, hand.Bet, hand.Result); break; case Result.BUST: case Result.LOSE: DealerWins(); break; case Result.PUSH: Push(i, hand.Bet); break; } } } /*if (dealer.HasBlackJack(0) && dealer.HasBlackJack(dealer.DealerIndex) == false) * PlayerWins(0); * else if (dealer.HasBlackJack(0) == false && dealer.HasBlackJack(dealer.DealerIndex)) * DealerWins(); * else if (dealer.HasBlackJack(0) && dealer.HasBlackJack(dealer.DealerIndex)) * Push(); * else if (dealer.players[0].GetComponent<PlayerController>().Hand.Total > 21) * DealerWins(); * else if (dealer.players[dealer.DealerIndex].GetComponent<PlayerController>().Hand.Total > 21) * PlayerWins(0); * else if (dealer.players[0].GetComponent<PlayerController>().Hand.Total > dealer.players[dealer.DealerIndex].GetComponent<PlayerController>().Hand.Total) * PlayerWins(0); * else if (dealer.players[0].GetComponent<PlayerController>().Hand.Total < dealer.players[dealer.DealerIndex].GetComponent<PlayerController>().Hand.Total) * DealerWins(); * else * Push(); */ // Check if player is out of money. if (dealer.players[0].GetComponent <PlayerController>().Bank < 2) { ToEndGame(); return; } ToStartHand(); }