Ejemplo n.º 1
0
    public int GetPrice(MinionBoughtDef.StatNames statName, int lvl)
    {
        int price         = -1;
        var levelToSearch = lvl - 1;

        switch (statName)
        {
        case MinionBoughtDef.StatNames.HP:
            price = hpPerLevel.Length >= levelToSearch ? hpPerLevel[levelToSearch].newPrice : -99;
            break;

        case MinionBoughtDef.StatNames.SPD:
            price = speedPerLevel.Length >= levelToSearch ? speedPerLevel[levelToSearch].newPrice : -99;
            break;

        case MinionBoughtDef.StatNames.PASSIVE:
            price = passivePerLevel.Length >= levelToSearch ? passivePerLevel[levelToSearch].newPrice : -99;
            break;

        case MinionBoughtDef.StatNames.SKILL:
            price = skillPerLevel.Length >= levelToSearch ? skillPerLevel[levelToSearch].newPrice : -99;
            break;
        }

        return(price);
    }
Ejemplo n.º 2
0
    public float GetStatByStatId(MinionBoughtDef.StatNames id, MinionType minionType)
    {
        var result = -1f;

        switch (id)
        {
        case MinionBoughtDef.StatNames.HP:
            result = hp;
            break;

        case MinionBoughtDef.StatNames.SPD:
            result = speed;
            break;

        case MinionBoughtDef.StatNames.PASSIVE:
            if (minionType == MinionType.Healer)
            {
                result = healPerSecond;
            }

            /*else if (minionType == MinionType.WarScreamer)
             *  result = passiveSpeedDelta;*/

            break;

        case MinionBoughtDef.StatNames.SKILL:

            switch (minionType)
            {
            case MinionType.Runner:
                result = skillDeltaSpeed;
                break;

            case MinionType.Tank:
                result = shieldHits;
                break;

            case MinionType.Healer:
                result = skillHealAmount;
                break;

            case MinionType.Zeppelin:
                result = miniZeppelinStat.hitsToDie;
                break;

            case MinionType.WarScreamer:
                result = activeSpeedDelta;
                break;

            case MinionType.Dove:
                result = skillCooldown;
                break;
            }
            break;
        }

        return(result);
    }
Ejemplo n.º 3
0
    public void IncrementMinionStat(MinionType type, MinionBoughtDef.StatNames statName)
    {
        var saved = _minionsBoughts.list.FirstOrDefault(i => i.type == type.ToString());

        if (saved != null)
        {
            saved.IncrementLevelToStat(statName);
            SaveSystem.Save(_minionsBoughts, SaveSystem.MINIONS_SAVE_NAME);
        }
    }
Ejemplo n.º 4
0
    public void SetItem(int statLvl, float currValue, float nextValue, MinionBoughtDef.StatNames id, int price)
    {
        this.id             = id;
        statName.text       = id.ToString() + " :";
        this.currValue.text = currValue.ToString();
        this.nextValue.text = nextValue.ToString();

        levelBar.fillAmount = float.Parse(statLvl.ToString()) / ShopManager.MAX_MINION_LEVEL;

        buyButton.onClick.AddListener(() => BuyPressed());
        buyButton.GetComponentInChildren <Text>().text = price + " CHIPS";
    }
Ejemplo n.º 5
0
    public string GetMinionUpgradeDescription(string minionType, MinionBoughtDef.StatNames statId)
    {
        MinionType type      = GameUtils.ToEnum(minionType, MinionType.Runner);
        var        list      = new List <string>();
        var        storeData = _storeInfoData[type];
        var        statInfo  = storeData.statsInfo.FirstOrDefault(i => i.type == statId.ToString());

        if (statInfo != null)
        {
            return(statInfo.info);
        }

        return("");
    }
Ejemplo n.º 6
0
    void StatBuyPressed(MinionBoughtDef.StatNames id, StatUpgradeItem item)
    {
        var couldBuy = _shopManager.BuyStat(id);

        if (!couldBuy)
        {
            SoundManager.instance.PlaySound(SoundFxNames.fail_buy);
            item.NoCoinsAnimation();
        }
        else
        {
            SoundManager.instance.PlaySound(SoundFxNames.upgrade_success);
        }
    }
Ejemplo n.º 7
0
    public bool BuyStat(MinionBoughtDef.StatNames id)
    {
        var currency  = _gm.User.Currency;
        var currLevel = _gm.User.GetMinionBought(_popup.selected).GetStatLevel(id);
        var statPrice = _storeStatsCurrencyDef[_popup.selected].GetPrice(id, currLevel + 1);

        if (currency - statPrice < 0)
        {
            return(false);
        }

        _gm.User.BuyMinionStat(_popup.selected, id, Mathf.CeilToInt(statPrice));
        //Call again to refresh data.
        _popup.SetCurrency(_gm.User.Currency);
        _popup.UpdateSkillsPanel();

        return(true);
    }
Ejemplo n.º 8
0
    public void SetPopup(MinionBoughtDef.StatNames statId, string currLevelVal, string nextLevelVal, int currLevel)
    {
        _statId = statId;
        var currLevelFloat = float.Parse(currLevel.ToString());

        currLevelFill.fillAmount = currLevelFloat / ShopManager.MAX_MINION_LEVEL;
        currLevelFloat++;
        nextLevelFill.fillAmount = currLevelFloat / ShopManager.MAX_MINION_LEVEL;

        var currInfo = CURR_LEVEL.Replace("%", statId.ToString()) + currLevelVal;
        var nextInfo = NEXT_LEVEL.Replace("%", statId.ToString()) + nextLevelVal;

        if (description.text == "")
        {
            description.text = statId == MinionBoughtDef.StatNames.HP ? ShopManager.HP_STAT_DESC : ShopManager.SPEED_STAT_DESC;
        }
        description.text += '\n';
        description.text += '\n' + currInfo + '\n' + nextInfo;
    }
Ejemplo n.º 9
0
 public void BuyMinionStat(MinionType type, MinionBoughtDef.StatNames statName, int price)
 {
     Currency -= price;
     _inventory.IncrementMinionStat(type, statName);
 }