Exemple #1
0
    public IDictionary <string, ICard> GetDictionaryCards(SubTypeCard subTypeCard)
    {
        IDictionary <string, ICard> dictionary;
        var isExists = _dictCards.TryGetValue(subTypeCard, out dictionary);

        if (isExists == false)
        {
            throw new UnityException("It is unknown dictionary (ObjectStorage)");
        }
        return(dictionary);
    }
Exemple #2
0
    //--------------------Берем рандомную карту по типу и редкости
    public ICard GetRandomCardByType(SubTypeCard type, CardRarity rarity)
    {
        var   flag      = false;
        ICard value     = null;
        var   dictCards = GetDictionaryCards(type);

        while (!flag)
        {
            var index = RandomExtensions.Random(dictCards.Count);
            var card  = dictCards.Values.ElementAt(index);
            if (card.GetDataCard().Rarity != rarity)
            {
                continue;
            }
            value = card;
            flag  = true;
        }
        return(value);
    }