예제 #1
0
 public void DrawHand(scr_Deck deck)
 {
     for (int i = 0; i < 5; i++)
     {
         DrawCard(deck);
     }
 }
예제 #2
0
    public void CreateDeck(string deckName)
    {
        deck = ((GameObject)Instantiate(Resources.Load("Prefabs/Player/Deck"), gameObject.transform)).GetComponent <scr_Deck>();
        deck.Init(deckName);

        deck.gameObject.GetComponent <UnityEngine.UI.Button>().onClick.AddListener(DrawCard);
    }
예제 #3
0
 public void DrawCard(scr_Deck deck)
 {
     if (deck.cards.Count > 0)
     {
         //Get the card from the deck
         GameObject newCard = deck.cards[0];
         newCard.SetActive(true);
         deck.cards.RemoveAt(0);
         newCard.transform.SetParent(gameObject.transform); //Set card to be child of hand
         hand.Add(newCard);
         RepositionCards();
     }
     else
     {
         // Lose? Out of cards in deck!
     }
 }