// -------------------------------------------------------------------------------------------- public Card DrawNextCard() { NumCardsLeft = 0; Card toReturn = null; for (int i = 0; i < _cards.Length; i++) { if (_cards[i].hasBeenDrawn) { continue; } else { NumCardsLeft++; } if (toReturn == null) { CardAsDeckMember cardAsDeckMember = _cards[i]; cardAsDeckMember.hasBeenDrawn = true; _cards[i] = cardAsDeckMember; NumCardsLeft--; toReturn = _cards[i].card; } } if (toReturn == null) { Debug.LogError($"There were no cards to draw"); } return(toReturn); }
// -------------------------------------------------------------------------------------------- public void ShuffleDeck(uint seed) { for (uint i = 0; i < _cards.Length; i++) { CardAsDeckMember temp = _cards[i]; int randIndex = _game.Random.Next(seed + i, 0, _cards.Length); _cards[i] = _cards[randIndex]; _cards[randIndex] = temp; } }