Beispiel #1
0
 public void onInfoPanelClick(int index)
 {
     infoPanelManager.setTextfields(AllHeros.GetFighter(index));
     shopPanel.SetActive(false);
     moneyPanel.SetActive(false);
     nextLevelButtonPanel.SetActive(false);
     infoPanel.SetActive(true);
     upgradeButtonPanel.SetActive(false);
 }
Beispiel #2
0
    void LoadHeroes()
    {
        HeroesData data = SaveSystem.LoadHeroes();

        //all heroes
        for (int i = 0; i < AllHeros.heroes.Length; i++)
        {
            AllHeros.heroes[i].maxHP        = (int)data.allMaxHp[i];
            AllHeros.heroes[i].attackDamage = (int)data.allAttackDamage[i];
            AllHeros.heroes[i].critChance   = (int)data.allCritChance[i];
        }

        //heroes
        for (int i = 0; i < data.count; i++)
        {
            Fighter f = new Fighter(AllHeros.GetFighter(data.id[i]));
            f.setID(data.id[i]);
            f.currentHP = (int)data.currentHP[i];
            Heroes.AddHero(f);
        }
    }
Beispiel #3
0
    public void onHeroBuyClick(int itemID)
    {
        if (getItemByID(itemID).price <= Vault.money)
        {
            Fighter f = new Fighter(AllHeros.GetFighter(itemID));
            f.setID(itemID);
            Heroes.AddHero(f);
            Vault.addMoney(-getItemByID(itemID).price);
            nextLevelButton.interactable = true;
            upgradeButton.interactable   = true;
            isMandatory = false;
        }
        updateBalance();
        setQuantityTexts();

        //Tutorial load
        if (!Tutorial.isCompleted && !FindObjectOfType <TutorialShop>().isUpgradesCompleted)
        {
            FindObjectOfType <TutorialShop>().loadTutorialUpgrade();
            FindObjectOfType <TutorialShop>().isUpgradesCompleted = true;
        }
    }
Beispiel #4
0
    public void onUpgradeClick(string type)
    {
        Upgrade temp = null;

        if (type == "health")
        {
            temp = health;
        }
        if (type == "attack")
        {
            temp = attack;
        }
        if (type == "defense")
        {
            temp = defense;
        }

        if (Vault.money < temp.price)
        {
            return;
        }
        Vault.addMoney(-temp.price);
        float newPrice = temp.price * temp.priceMultiplier;

        temp.price = (int)newPrice;


        for (int i = 0; i < Heroes.count; i++)
        {
            Heroes.getHero(i).Upgrade(type, temp.amount);
        }

        AllHeros.GetFighter(ID).Upgrade(type, temp.amount);

        FindObjectOfType <Shop>().updateBalance();
        setStatisticText();
        setUpgradePrices();
    }
Beispiel #5
0
 public void setStatisticText()
 {
     healthText.text  = AllHeros.GetFighter(ID).maxHP + "";
     attackText.text  = AllHeros.GetFighter(ID).attackDamage + "";
     defenseText.text = AllHeros.GetFighter(ID).defense + "";
 }