private void DrawCard() { int k = Random.Range(0, remainingCards.Count); Card.PlayingCard playingCard = remainingCards[k]; remainingCards.RemoveAt(k); cardParent.AddCard(playingCard); if (remainingCards.Count == 0) { CardsEmpty?.Invoke(); } }
private void InitializeDeck() { // Spawn new cards remainingCards = new List <Card.PlayingCard>(); for (int i = 0; i < initialDeck.cards.Length; i++) { Card.PlayingCard newPlayingCard = Instantiate(playingCardPrefab, transform); newPlayingCard.SetCardData(initialDeck.cards[i]); newPlayingCard.gameObject.SetActive(false); remainingCards.Add(newPlayingCard); } // Shuffle the cards // int n = remainingCards.Count; // while (n > 1) // { // n--; // int k = Random.Range(0, n + 1); // Card value = remainingCards[k]; // remainingCards[k] = remainingCards[n]; // remainingCards[n] = value; // } }
private void HandleEndDragging(PlayingCard playingCard) { handArea.AddCard(playingCard); }
private void HandleBeginDragging(PlayingCard playingCard) { handArea.RemoveCard(playingCard); playingCard.transform.SetParent(transform, false); }