Exemplo n.º 1
0
    /// <summary>
    /// Plays dealer hand a finish condition is met.
    /// </summary>
    private void PlayDealer()
    {
        if (dealer.CardCount() == 2)
        {
            dealer.FlipCard();
        }

        bool allBlackJack = true;

        for (int index = 0; index < player.GetHand().Count; index++)
        {
            if (player.GetHandValues()[index] != 21)
            {
                allBlackJack = false;
            }
            if (player.GetHand()[index].Count != 2)
            {
                allBlackJack = false;
            }
        }
        if (allBlackJack)
        {
            dealer.FinishHand();
        }


        int bustCount = 0;

        for (int index = 0; index < player.GetHand().Count; index++)
        {
            if (player.GetHandValues()[index] > 21)
            {
                bustCount++;
            }
        }
        if (bustCount == player.GetHand().Count)
        {
            dealer.FinishHand();
        }


        while (!dealer.GetHandFinished())
        {
            Deal();
        }

        int value = dealer.GetHandValue();

        if (value > 21)
        {
        }
        else if (value == 21 && dealer.GetHand().Count == 2)
        {
        }
        else
        {
        }
        UpdateCardValues();
        CalculateWinnings();
        //betSlider.maxValue = player.Credit;
        EnableRedoBet();
        canBet = true;
        //betSlider.interactable = true;
        splitButton.gameObject.SetActive(false);
        doubleButton.gameObject.SetActive(false);
        standButton.gameObject.SetActive(false);
    }