Пример #1
0
    public void OnHit()
    {
        if (playerCards < 6)
        {
            playerHand[playerCards] = deck.Draw();
            playerButtons[playerCards].gameObject.SetActive(true);
            playerCards++;

            if (GetHandTotal(playerHand) > 21)
            {
                payout = winCondition.Bust;
            }
            Debug.Log(payout.ToString());
        }
    }
Пример #2
0
    public void SwapCards()
    {
        if (cardSwaps < 3)
        {
            for (int i = 0; i < cardIndex.Length; i++)
            {
                if (cardIndex[i] == -1)
                {
                    continue;
                }
                hand[cardIndex[i]] = deck.Draw();
                cardIndex[i]       = -1;
            }
            foreach (Button button in buttons)
            {
                button.GetComponent <CardButton>().isSelected = false;
                button.GetComponent <Image>().color           = Color.white;
            }
            cardSwaps++;
        }
        if (cardSwaps >= 2)
        {
            CheckPayout();
            Debug.Log(payout.ToString());
            switch (payout)
            {
            case winCondition.RoyalFlush:
                bet *= 100001;
                break;

            case winCondition.StraightFlush:
                bet *= 10001;
                break;

            case winCondition.FourOfAKind:
                bet *= 1001;
                break;

            case winCondition.FullHouse:
                bet *= 101;
                break;

            case winCondition.Flush:
                bet *= 51;
                break;

            case winCondition.Straight:
                bet *= 26;
                break;

            case winCondition.ThreeOfAKind:
                bet *= 11;
                break;

            case winCondition.TwoPair:
                bet *= 6;
                break;

            case winCondition.Pair:
                bet *= 2;
                break;

            case winCondition.None:
                bet = 0;
                break;
            }
        }
    }