//Deals 2 cards to the player and dealer, with the second dealer card face down. //Checks if anyone has a Natural Blackjack and auto-flips if so. public IEnumerator Deal() { player.SetInsurance(false); anim.CrossFade("godBossResetArmsAnimation"); while (anim.isPlaying) { yield return(new WaitForSeconds(0.01f)); } if (deck.GetCardsRemaining() < 10) { yield return(StartCoroutine(ReshuffleDeck())); } while (anim.isPlaying || voice.isPlaying) { yield return(new WaitForSeconds(0.01f)); } TogglePointToDeck(); while (anim.isPlaying) { yield return(new WaitForSeconds(0.01f)); } yield return(new WaitForSeconds(0.5f)); yield return(StartCoroutine(DealCardToPlayer())); yield return(StartCoroutine(DealCardToSelf())); yield return(StartCoroutine(DealCardToPlayer())); if (player.GetHandValue() > 21) { player.CheckAces(); } //yield return StartCoroutine(DealCardToSelf()); yield return(StartCoroutine(DealCardToSelfFaceDown())); yield return(new WaitForSeconds(0.5f)); anim.CrossFade("godBossDeckIdleAnimation"); if (hand[0].GetComponent <cardScript>().GetValue() == 11 && UI.GetFunds() >= (int)(player.GetBetAmount() * 0.5)) //gives the player the option to purchase insurance { UI.SetInsurance(true); } else if (player.GetHandValue() == 21 || GetHandValue() == 21) { StartCoroutine(Blackjack()); } else { UI.SetHitAndStand(true); if (UI.GetFunds() >= player.GetBetAmount()) { UI.SetDoubleDown(true); } } }