protected override void ShowValue()
        {
            BlackJackManager manager    = GameObject.Find("BlackJackManager").GetComponent <BlackJackManager>();
            BlackJackHand    playerHand = GameObject.Find("Player Hand Value").GetComponent <BlackJackHand>();

            //  BUG     : Player does not win on a "Natural Blackjack"
            //  CATEGORY: GAME RULES
            //  STATUS  : PENDING REVIEW
            if (playerHand.handVals == 21)
            {
                manager.PlayerWin();
            }
            else
            {
                base.ShowValue();
            }
        }
예제 #2
0
    protected override void ShowValue()
    {
        if (hand.Count > 1)
        {
            if (!reveal)
            {
                handVals = hand[1].GetCardHighValue();

                total.text = "Dealer: " + handVals + " + ???";
            }
            else
            {
                handVals = GetHandValue();

                total.text = "Dealer: " + handVals;

                BlackJackManager manager = GameObject.Find("BlackJackManager").GetComponent <BlackJackManager>();

                if (handVals > 21)
                {
                    manager.DealerBusted();
                }
                else if (!DealStay(handVals))
                {
                    Invoke("HitMe", 1);
                }
                else
                {
                    BlackJackHand playerHand = GameObject.Find("Player Hand Value").GetComponent <BlackJackHand>();

                    if (handVals < playerHand.handVals)
                    {
                        manager.PlayerWin();
                    }
                    else
                    {
                        manager.PlayerLose();
                        //fartSound.Play(); //also no
                    }
                }
            }
        }
    }
예제 #3
0
    protected override void ShowValue(List <DeckOfCards.Card> currentHand, Transform handBase, Text currentTotal, int currentHandVal)
    {
        if (currentHand.Count > 1)
        {
            if (!reveal)
            {
                currentHandVal = currentHand[1].GetCardValue();

                currentTotal.text = "Dealer: " + currentHandVal + " + ???";
            }
            else
            {
                currentHandVal = GetHandValue(currentHand);

                currentTotal.text = "Dealer: " + currentHandVal;

                BlackJackManager manager = GameObject.Find("BlackJackManager").GetComponent <BlackJackManager>();

                if (currentHandVal > 21)
                {
                    manager.DealerBusted();
                }
                else if (!DealStay(currentHandVal))
                {
                    DealMeIn(currentHand, handBase, currentTotal, currentHandVal);
                }
                else
                {
                    BlackJackHand playerHand = GameObject.Find("PlayerHandValue1").GetComponent <BlackJackHand>();

                    if (currentHandVal < playerHand.handVal1 || currentHandVal < playerHand.handVal2)
                    {
                        manager.PlayerWin();
                    }
                    else
                    {
                        manager.PlayerLose();
                    }
                }
            }
        }
    }
예제 #4
0
    protected virtual void ShowValue()
    {
        handVals = GetHandValue();

        total.text = "Player: " + handVals;

        BlackJackManager manager = GameObject.Find("BlackJackManager").GetComponent <BlackJackManager>();

        if (handVals > 21)
        {
            manager.PlayerBusted();
        }
        if (handVals == 21 && isSetup) // if player has 21 during setup, show BlackJack! prompt
        {
            manager.BlackJack();
        }
        if (handVals == 21 && !isSetup) // if player has 21 after setup, automatically declare win
        {
            manager.HideShowPlayerButtons(false);
            manager.PlayerWin();
        }
    }