public void initDeck(CardTypes cardTypes) { deckData.deckCards.Add(cardTypes.getCardFromEnum(CardTypes.CardEnum.shield)); deckData.deckCards.Add(cardTypes.getCardFromEnum(CardTypes.CardEnum.threaten)); for (int i = 0; i < 4; i++) { deckData.deckCards.Add(cardTypes.getCardFromEnum(CardTypes.CardEnum.smack)); deckData.deckCards.Add(cardTypes.getCardFromEnum(CardTypes.CardEnum.defend)); } deckData.discardCards = new List <Card>(); deckData.hand = new List <Card>(); }
public List <Card> generateCards(int numCardsToGenerate) { List <CardTypes.CardEnum> cardsCopy = cardTypes.obtainableCards; List <Card> cards = new List <Card>(); for (int i = 0; i < numCardsToGenerate; i++) { if (cardsCopy.Count == 0) { break; } int randomIndex = UnityEngine.Random.Range(0, cardsCopy.Count); cards.Add(cardTypes.getCardFromEnum(cardsCopy[randomIndex])); cardsCopy.RemoveAt(randomIndex); } return(cards); }