Example #1
0
 //Parent all cards in a deck to the GameObject
 public void ParentDeck(BattleHandler.Deck deck, GameObject zone)
 {
     foreach (GameObject card in deck.GetCards())
     {
         card.transform.SetParent(zone.transform);
         card.GetComponent <Draggable>().OnCardClicked += HandleCardClicked;
     }
 }
Example #2
0
    void PopulateShopZone()
    {
        List <GameObject> tempDeck = new List <GameObject>();

        tempDeck.Add(Instantiate(BattleAssets.GetInstance().Slop, new Vector3(0, 0, 0), Quaternion.identity));
        tempDeck.Add(Instantiate(BattleAssets.GetInstance().Kiki, new Vector3(0, 0, 0), Quaternion.identity));
        tempDeck.Add(Instantiate(BattleAssets.GetInstance().Bouba, new Vector3(0, 0, 0), Quaternion.identity));
        shopDeck = new BattleHandler.Deck(tempDeck);
        ParentDeck(shopDeck, shopZone);
    }
Example #3
0
 private void Awake()
 {
     instance  = this;
     shopZone  = GameObject.Find("ShopZone");
     sellZone  = GameObject.Find("SellZone");
     moneyText = GameObject.Find("MoneyText").GetComponent <Text>();
     fullDeck  = GlobalValues.Deck;
     LoadGlobalValues();
     LoadPrices();
     PopulateShopZone();
     PopulateSellZone();
 }
Example #4
0
    void PopulateSellZone()
    {
        BattleHandler.Deck fullDeck = GlobalValues.Deck;

        List <string>     cardsAdded = new List <string>();
        List <GameObject> tempDeck   = new List <GameObject>();

        foreach (GameObject card in fullDeck.GetCards())
        {
            if (card.GetComponent <Card>().cardName != "Stab" && card.GetComponent <Card>().cardName != "Block" && !cardsAdded.Contains(card.GetComponent <Card>().cardName))
            {
                tempDeck.Add(Instantiate(card, new Vector3(0, 0, 0), Quaternion.identity));
                cardsAdded.Add(card.GetComponent <Card>().cardName);
            }
        }
        sellDeck = new BattleHandler.Deck(tempDeck);
        ParentDeck(sellDeck, sellZone);
    }