public IEnumerator GetNewCard(int amount) { for (int i = 0; i < amount; i++) { if (remainingDeck.Count != 0) { int rand = Random.Range(0, remainingDeck.Count); inHand.Add(remainingDeck[rand]); GameObject nc = Instantiate(cardPrefab, transform.position, Quaternion.identity); inhandie.Add(nc); nc.transform.SetParent(gameObject.transform); CardHolder newC = nc.GetComponent <CardHolder>(); newC.card = remainingDeck[rand]; newC.deck = this; newC.mana = myMana; if (side == Side.player) { nc.GetComponent <CardHolder>().side = CardHolder.Side.Player; } newC.LoadCard(); nc.transform.localScale = new Vector3(2, 2, 2); remainingDeck.RemoveAt(rand); } yield return(new WaitForSeconds(0.5f)); } }
public void GetSpecificCard(Card card) { inHand.Add(card); GameObject nc = Instantiate(cardPrefab, transform.position, Quaternion.identity); inhandie.Add(nc); nc.transform.SetParent(gameObject.transform); CardHolder newC = nc.GetComponent <CardHolder>(); newC.card = card; newC.deck = this; newC.mana = myMana; if (side == Side.player) { nc.GetComponent <CardHolder>().side = CardHolder.Side.Player; } newC.LoadCard(); nc.transform.localScale = new Vector3(2, 2, 2); }