Exemplo n.º 1
0
    public void HandleCardClicked(GameObject card)
    {
        Debug.Log("Card Clicked Event Success: " + card);
        //We buy a card if we have money
        if (money >= card.GetComponent <Card>().price&& card.transform.parent == shopZone.transform)
        {
            UpdateMoney(-1 * card.GetComponent <Card>().price);

            List <GameObject> cards = new List <GameObject>();
            BattleAssets.GetInstance().GetCards(cards);

            foreach (GameObject c in cards)
            {
                //Must iterate through all cards here because we need to add a prefab, not the already instanced card in the shop since it will be deleted upon next scene load.
                Debug.Log(c.GetComponent <Card>().cardName + card.GetComponent <Card>().cardName);
                if (c.GetComponent <Card>().cardName == card.GetComponent <Card>().cardName)
                {
                    GlobalValues.Deck.Add(c);
                }
            }
        }
        //We sell a card if we have money
        else if (card.transform.parent == sellZone.transform && fullDeck.Contains(card))
        {
            UpdateMoney(1 * card.GetComponent <Card>().price);
            GlobalValues.Deck.Remove(card);
        }
    }
Exemplo n.º 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);
    }
Exemplo n.º 3
0
    private BattleHandler.Deck InitializeDeck()
    {
        List <GameObject> testDeck = new List <GameObject>();

        testDeck.Add(BattleAssets.GetInstance().Stab);
        testDeck.Add(BattleAssets.GetInstance().Stab);
        testDeck.Add(BattleAssets.GetInstance().Stab);
        testDeck.Add(BattleAssets.GetInstance().Block);
        testDeck.Add(BattleAssets.GetInstance().Block);
        testDeck.Add(BattleAssets.GetInstance().Block);
        return(new BattleHandler.Deck(testDeck));
    }
    private void UpdateHealthBars()
    {
        BattleAssets.GetInstance().SelfHPBar.text = CURRENT_PLAYER_HEALTH + "/" + MAX_PLAYER_HEALTH;
        BattleAssets.GetInstance().EnemyHPBar.text = CURRENT_ENEMY_HEALTH + "/" + MAX_ENEMY_HEALTH;

        if (CURRENT_PLAYER_HEALTH <= 0f)
        {
            GameOver();
        }
        if (CURRENT_ENEMY_HEALTH <= 0f)
        {
            Victory();
        }
    }
Exemplo n.º 5
0
    public void AddPrices()
    {
        IDictionary <string, int> dict = townPlayerAt.GetEconomy().GetPricesDictionary();

        foreach (GameObject card in shopDeck.GetCards())
        {
            card.GetComponent <Card>().price = dict[card.GetComponent <Card>().cardName];

            Text txt = Instantiate(BattleAssets.GetInstance().PriceText, new Vector3(0, 0, 0), Quaternion.identity);
            txt.transform.SetParent(card.transform);
            txt.transform.localPosition = new Vector3(465, -105, 0);
            txt.text = card.GetComponent <Card>().price.ToString();
        }
    }