Exemple #1
0
    public void UpdateSlider(int xpToBeAdded)
    {
        if (!gridMan.isMaxedActually)
        {
            bounds = GetBounds();
        }

        current += xpToBeAdded;
        if (!gridMan.isMaxedActually)
        {
            if (heroCloneToPass[1] < heroLevelCap && (accumHeroXp + xpToBeAdded < CharectorStats.XpOfMaxLevel(CharectorStats.getTempHero())))
            {
                xpBar.SetActive(true);
                AddSubtractXP();
                tempMaxReduced?.Invoke();
            }
            else if (heroCloneToPass[1] < heroLevelCap && (accumHeroXp + xpToBeAdded >= CharectorStats.XpOfMaxLevel(CharectorStats.getTempHero())))
            {
                xpBar.SetActive(false);
                currentLvlText.text = CharectorStats.findCurrentMaxLevel(CharectorStats.getTempHero()).ToString();
                tempMax?.Invoke();
            }
            else if (heroCloneToPass[1] >= heroLevelCap && xpToBeAdded < 0)
            {
                xpBar.SetActive(true);
                AddSubtractXP();
                tempMaxReduced?.Invoke();
            }
        }
        accumHeroXp += xpToBeAdded;
    }
    public void MeltHeros()
    {
        CharectorStats.meltHero(SelectedToMeltList, xpToBeAdded);
        int tempHero = CharectorStats.getTempHero();

        if (isMaxedTemp)
        {
            CharectorStats.updateHero(tempHero, CharectorStats.XpOfMaxLevel(tempHero), CharectorStats.findCurrentMaxLevel(tempHero));
            xpslide.reduceTempMax();
        }
        PlayServices.Instance.SaveData();
        OnEnable();
    }