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); }
//--------------------Берем рандомную карту по типу и редкости 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); }