//---------------- раздача карт по типу private IEnumerator SpawnCardsByType(CardType type, DropChance typeDropChance, DropChance rarityDropChance, int count) { SelectCardInDeck(_poolGameCard); yield return(new WaitForSeconds(0.3f)); SubTypeCard[] arrayType; var arrayRarity = new[] { CardRarity.Common, CardRarity.Rare, CardRarity.Legendary }; switch (type) { case CardType.Equipment: arrayType = new[] { SubTypeCard.Decoration }; break; case CardType.Spell: arrayType = new[] { SubTypeCard.AttackingSpell, SubTypeCard.ImprovingSpell, SubTypeCard.CurseSpell }; break; case CardType.Consumables: arrayType = new[] { SubTypeCard.Consumables }; break; default: throw new UnityException("It is unknown CardType in SpawnCardsByType"); } var typeCard = arrayType[RandomExtensions.GetRandomElementDictionary(typeDropChance)]; var rarity = arrayRarity[RandomExtensions.GetRandomElementDictionary(rarityDropChance)]; var number = 1; foreach (var card in _poolGameCard) { if (number > count) { break; } if (card.activeSelf) { continue; } var cardDisplay = card.GetComponent <ActionsWithCards>(); var randomCard = _objectStorage.GetRandomCardByType(typeCard, rarity); cardDisplay.СhangeCardType(randomCard); cardDisplay.SetIdCard(number); cardDisplay.CardGame.DisplayCardInGame(card); cardDisplay.SetDependecies(_publisher, _animaManager); card.SetActive(true); _animaManager.SetStateAnimation(card, "dist_num", number); yield return(new WaitForSeconds(0.2f)); ++number; } }