Example #1
0
    public void Hit(int amount)
    {
        if (!isPlayersTurn || BetValue <= 0)
        {
            return;
        }
        if (isFirstHit)
        {
            isFirstHit = false;
            StartCoroutine(SetupCards());

            return;
        }

        for (int i = 0; i < amount; i++)
        {
            Card card = deck.Pop();
            if (playerCardStack.PeekBust(card))
            {
                StartCoroutine(ExecuteBust());
            }

            playerCardStack.Add(card);

            if (playerCardStack.HasNaturalBlackJack)
            {
                StartCoroutine(ExecuteWon());
            }
        }
    }
Example #2
0
 private void DealerHit(int amount = 1, bool isFaceDown = true, bool force = false)
 {
     if (isPlayersTurn && !force)
     {
         return;
     }
     for (int i = 0; i < amount; i++)
     {
         dealerCardStack.Add(deck.Pop(isFaceDown));
     }
 }