/* * cards dealt to players * First player hits/sticks/bust * Dealer's turn;must have minimum of 17 scor hand * Dealer's cards; first card ids hidden,subsequent cards are facing */ #region public methods() public void Hit() { player.Push(deck.Pop()); player1.Push(deck.Pop()); if (player.HandValue() > 21) { hitButton.interactable = false; stickButton.interactable = false; StartCoroutine(DealersTurn()); } if (player1.HandValue() > 21) { hitButton.interactable = false; stickButton.interactable = false; StartCoroutine(DealersTurn()); } }
//int[] cards = new int[] { }; // To test and force card onto the player private void OnGUI() { if (GUI.Button(new Rect(10, 10, 256, 28), "Hit Me!")) { player.Push(dealer.Pop()); } //if (GUI.Button(new Rect(10, 10, 256, 28), "Hit Me!")) //{ // player.Push(cards[count++]); //} }
void HitDealer() { int card = deck.Pop(); if (dealersFirstCard < 0) { dealersFirstCard = card; } dealer.Push(card); if (dealer.CardCount >= 2) { ViewCard view = dealer.GetComponent <ViewCard>(); view.Toggle(card, true); } }