public void AddCard(CardBase card) { CardPrefab prefab = new CardPrefab(); prefab.SetCard(card); CardHand.Add(prefab); }
public void SpawnCards() { foreach (var card in CardsToShow) { GameObject newGO = Instantiate(CardPrefab, CardsPanel, false); CardPrefab cardPrefab = newGO.GetComponent <CardPrefab>(); cardPrefab.SetCard(card.Name, card.Description, card.Image, card); Button cardButton = newGO.GetComponent <Button>(); cardButton.onClick.AddListener(delegate { SelectCard(cardPrefab); }); } }
public void SpawnCards() { foreach (var card in Player.Instance.Cards) { Card newCardInstance = Object.Instantiate(card) as Card; newCardInstance.Init(Player.Instance); GameObject newGO = Instantiate(CardPrefab, CardParent, false); CardPrefab cardPrefab = newGO.GetComponent <CardPrefab>(); cardPrefab.SetCard(card.Name, card.Description, card.Image, newCardInstance); Button cardButton = newGO.GetComponent <Button>(); cardButton.onClick.AddListener(delegate { CardDoAction(newCardInstance); }); } }