Ejemplo n.º 1
0
 void DealClicked()
 {
     // Reset hand, hide text, prep for new hand
     playerScript.ResetHand();
     dealerScript.ResetHand();
     // Hide deal hand score at start of deal
     mainText.gameObject.SetActive(false);
     dealerScoreText.gameObject.SetActive(false);
     GameObject.Find("Deck").GetComponent <DeckScript>().Shuffle();
     playerScript.StartHand();
     dealerScript.StartHand();
     // Update the scores displayed
     scoreText.text       = "Hand: " + playerScript.handValue.ToString();
     dealerScoreText.text = "Hand: " + dealerScript.handValue.ToString();
     // Enable to hide one of the dealer's cards
     hideCard.GetComponent <Renderer>().enabled = true;
     // Adjust buttons visibility
     dealButton.gameObject.SetActive(false);
     hitButton.gameObject.SetActive(true);
     standButton.gameObject.SetActive(true);
     standButtonText.text = "Stand";
     // Set standard pot size
     pot           = 40;
     betsText.text = "Bets: $" + pot.ToString();
     playerScript.AdjustMoney(-20);
     cashText.text = "$" + playerScript.GetMoney().ToString();
 }
Ejemplo n.º 2
0
    private void dealClicked()
    {
        PlayerScript.ResetHand();
        dealerScript.ResetHand();

        MainText.gameObject.SetActive(false);
        DealerScoreText.gameObject.SetActive(false);

        GameObject.Find("Deck").GetComponent <DeckScript>().Shuffle();

        PlayerScript.StartHand();
        dealerScript.StartHand();

        scoreText.text       = "Hand: " + PlayerScript.handValue.ToString();
        DealerScoreText.text = "Hand: " + dealerScript.handValue.ToString();

        hidecard.GetComponent <Renderer>().enabled = true;

        dealBtn.gameObject.SetActive(false);
        hitBtn.gameObject.SetActive(true);
        standBtn.gameObject.SetActive(true);
        standBtnText.text = "Stand";

        pot           = 40;
        betsText.text = "Bets: $" + pot.ToString();
        PlayerScript.AdjustMoney(-20);
        CashText.text = PlayerScript.GetMoney().ToString();
    }
Ejemplo n.º 3
0
    private void DealClicked()
    {
        scoreText.gameObject.SetActive(true); // I need to make this visible somewhere at the beginning of the game.

        // Reset round, hide text, prep for new hand
        playerScript.ResetHand();
        dealerScript.ResetHand();

        // Hide dealers hand score at the start of deal
        mainText.gameObject.SetActive(false);
        dealerScoreText.gameObject.SetActive(false);
        winText.gameObject.SetActive(false);

        GameObject.Find("Deck").GetComponent <DeckScript>().Shuffle();
        playerScript.StartHand();
        dealerScript.StartHand();

        // Update the scores displayed
        scoreText.text       = "Player: " + playerScript.handValue.ToString();
        dealerScoreText.text = "Dealer: " + dealerScript.handValue.ToString();

        // Enable to hide one of the Dealer's cards
        hideCard.GetComponent <Renderer>().enabled = true;

        // Adjust visibility of buttons
        dealBtn.gameObject.SetActive(false);
        hitBtn.gameObject.SetActive(true);
        standBtn.gameObject.SetActive(true);
        betBtn.gameObject.SetActive(false); // you shouldn't be able to bet while game in progress

        standBtnText.text = "Stand";

        // Set standard pot size
        win          = betTotal * 2;
        betText.text = "Bet: $" + betTotal.ToString();
        winText.text = "Win: $" + win.ToString();   // we need a pot text string...

        playerScript.AdjustMoney(-betTotal);
        cashText.text = "Balance: $" + playerScript.GetMoney().ToString();

        // Player Black Jack 21!!!
        if (playerScript.handValue == 21)
        {
            //mainText.text = "Black Jack!";
            //standClicks++;
            //standClicks++;

            RoundOver();
        }
    }