public void DealCards(int amount, AttackColorTypes type) { for (int i = 0; i < amount; i++) { DealCard(type); } }
public void DealCards(int amount) { for (int i = 0; i < amount; i++) { AttackColorTypes type = GetRandomType(); DealCard(type); } }
private CardInfo GetRandomCardInfo(AttackColorTypes type) { List <CardInfo> filteredCardsInfo = new List <CardInfo>(); for (int i = 0; i < availableCardsinfo.Count; i++) { if (availableCardsinfo[i].Color == type) { filteredCardsInfo.Add(availableCardsinfo[i]); } } //filteredCardsInfo = availableCardsinfo.Where(info => info.Color == type) as List<CardInfo>; int infoId = Random.Range(0, filteredCardsInfo.Count); return(filteredCardsInfo[infoId]); }
public Card CreateCard(AttackColorTypes type) { CardInfo info = GetRandomCardInfo(type); Card currentCard = GetCard(info); GameObject cardObject = Instantiate(cardPrefab, cardHolder); currentCard = (Card)cardObject.AddComponent(currentCard.GetType()); currentCard.Info = info; if (useCardUI) { CardUI ui = cardObject.GetComponent <CardUI>(); ui.ChangeUI(currentCard); Button cardSelect = cardObject.GetComponent <Button>(); cardSelect.onClick.AddListener(() => { currentCard.Use(battle); }); } return(currentCard); }
private Card GetRandomCard(AttackColorTypes type) { return(creator.CreateCard(type)); }
private void DealCard(AttackColorTypes type) { inventory.AddCard(GetRandomCard(type)); }