Пример #1
0
    public void AddCard(CardBase card)
    {
        CardPrefab prefab = new CardPrefab();

        prefab.SetCard(card);
        CardHand.Add(prefab);
    }
Пример #2
0
 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); });
     }
 }
Пример #3
0
 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); });
     }
 }