コード例 #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));
        }
    }
コード例 #3
0
 public Card GetCardPrefabById(int cardId)
 {
     return(allCards.GetCardById(cardId));
 }