예제 #1
0
        public void ButtonEvt_ConfirmHeldCards()
        {
            if (_isGameOver)
            {
                UnloadGame();
                Anim_Win(false);
                LoadGame();
                Anim_WinType(0);
                _isGameOver = false;
                return;
            }
            foreach (var card in _pokerHand)
            {
                if (!_cardsToHold.Contains(card))
                {
                    var newCard = PokerDeckController.ReturnRandomCard();
                    card.LoadCardData(newCard);
                }
            }
            _cardsToHold.Clear();
            var result = CheckForWinningHand(_pokerHand);

            Anim_Win(result != PokerScore.None);
            Anim_WinType((int)result);
            _score     += (int)result;
            _isGameOver = true;
        }
예제 #2
0
 private void UnloadGame()
 {
     foreach (var card in _pokerHand)
     {
         Destroy(card.gameObject);
     }
     PokerDeckController.ClearDeck();
     _cardsToHold.Clear();
     _pokerHand.Clear();
     Resources.UnloadUnusedAssets();
 }
예제 #3
0
 /// <summary>
 /// Every new deal comes from a fresh deck of cards.
 /// </summary>
 private void LoadGame()
 {
     PokerDeckController.PrepareDeck(_deckData);
     for (int i = 0; i < _pokerHandSize; i++)
     {
         var cardData = PokerDeckController.ReturnRandomCard();
         var card     = Instantiate(_pokerCardPrefab, _pokerHandGroup);
         card.LoadCardData(cardData);
         card.ButtonComponent.onClick.AddListener(() => ButtonEvt_CardClicked(card));
         _pokerHand.Add(card);
     }
 }