예제 #1
0
    public void SetupDeck(List <int> cardIds)
    {
        allCards = FindObjectOfType <AllCards>();

        foreach (int cardId in cardIds)
        {
            cards.Add(allCards.GetCardById(cardId));
        }

        ShuffleDeck();

        cardsInDeckText = FindObjectOfType <ConfigData>().GetCardsInDeckTextField();
        SetCardsInDeckTextField();
    }
예제 #2
0
    public Card DrawRandomCardFromDeck(string keyword)
    {
        List <Card> foundCards = FindCardsWithKeyword(keyword);

        if (foundCards.Count > 0)
        {
            Card cardToDraw = foundCards[Mathf.FloorToInt(Random.Range(0, foundCards.Count))];
            RemoveOneCardFromDeck(cardToDraw);
            SetCardsInDeckTextField();
            return(cardToDraw);
        }
        else
        {
            return(allCards.GetCardById(0));
        }
    }
 public Card GetCardPrefabById(int cardId)
 {
     return(allCards.GetCardById(cardId));
 }