Exemple #1
0
    /// <summary>
    /// Updates players hand values and displays special hand results
    /// </summary>
    public void UpdateCardValues()
    {
        int value = 0;

        if (playerTurn)
        {
            for (int index = player.GetHandValues().Count - 1; index >= 0; index--)
            {
                value = player.GetHandValues()[index];
                if (player.ScoreText[index] != null)
                {
                    player.ScoreText[index].GetComponent <Text>().text = value.ToString();
                }
                dealer.ScoreText.GetComponent <Text>().text = dealer.GetHand()[0].GetFaceValue().ToString();
                if (value == 21 && player.GetHand()[index].Count == 2)
                {
                    if (player.GetHandIndex() == index)
                    {
                        Stand();
                    }
                }

                /*if (value > 21)
                 * {
                 *
                 * }
                 * else if (value == 21 && player.GetHand()[index].Count == 2)
                 * {
                 *
                 *      if(player.GetHandIndex() == index)
                 *      {
                 *              Stand();
                 *      }
                 *
                 * }
                 * else
                 * {
                 *
                 * }*/
            }
        }
        else
        {
            dealer.ScoreText.GetComponent <Text>().text = dealer.GetHandValue().ToString();

            /*for (int index = player.GetHandValues().Count - 1; index >= 0; index--)
             * {
             *      value = player.GetHandValues()[index];
             *      if (value > 21)
             *      {
             *
             *      }
             *      else if (value == 21 && player.GetHand()[index].Count == 2)
             *      {
             *      }
             *      else if (value == dealer.GetHandValue())
             *      {
             *      }
             *      else if (value > dealer.GetHandValue() || dealer.GetHandValue() > 21)
             *      {
             *      }
             *      else
             *      {
             *      }
             * }*/
        }
    }