public void Hit() { FindObjectOfType <AudioManager>().Play("cardSlide6"); player.push(deck.Draw(0)); Debug.Log("Player score = " + player.BlackjackSumValue()); playerHandScore.text = player.BlackjackSumValue().ToString(); if (player.BlackjackSumValue() > 21) { // Player is bust. hitButton.interactable = false; standButton.interactable = false; StartCoroutine(DealersTurn()); } }
void StartRound() { // Empty the hands. while (player.HasCards) { player.Draw(0); } while (dealer.HasCards) { dealer.Draw(0); } // Draw the hands for (int i = 0; i < 2; i++) { player.push(deck.Draw(0)); dealer.push(deck.Draw(0)); } // Update text. winnerText.text = ""; dealerHandScore.text = ""; playerHandScore.text = player.BlackjackSumValue().ToString(); nextRoundButton.interactable = false; if (dealer.BlackjackSumValue() == 21) { winnerText.text = "Dealer has a blackjack!"; Stand(); } if (player.BlackjackSumValue() == 21) { winnerText.text = "Player has a blackjack!"; Stand(); } }