Exemplo n.º 1
0
        protected override IEnumerator BuffOverTime(float buffDuration)
        {
            float tickRate = float.Parse(effectDB.GetEffectStat(EffectStat.TickRate, fxName));

            string[] stat           = effectDB.GetEffectStat(EffectStat.StatsAffected, fxName).Split(new char[] { ',' });
            string[] fxAdditiveData = effectDB.GetEffectStat(EffectStat.Additive, fxName).Split(new char[] { ',' });
            string[] fxValueData    = effectDB.GetEffectStat(EffectStat.EffectValues, fxName).Split(new char[] { ',' });
            string   fxNameOverTime = fxName.ToString();

            do
            {
                for (int i = 0; i < fxAdditiveData.Length; i++)
                {
                    bool  isPercent = int.Parse(fxAdditiveData[i]) == 0;
                    float fxValue   = float.Parse(fxValueData[i]);
                    // Effect strength times stack count
                    float fxValResult = fxValue * buffList[fxNameOverTime][0];
                    if (stat[i] == "Mana")
                    {
                        if (isPercent)
                        {
                            fxValResult = (fxValue / 100) * selfMana.GetMaxAttributeValue();
                        }
                        selfMana.GainAttribute(fxValResult);
                    }
                }
                yield return(new WaitForSeconds(tickRate));
            } while (buffList[fxNameOverTime][1] <= buffDuration && isBattleActive);

            removeIDs.Add(fxNameOverTime);
        }
        public IEnumerator HealAfterLoss()
        {
            yield return(new WaitForSecondsRealtime(3f));

            Mana mana = GetComponent <Mana>();

            mana.GainAttribute(mana.GetMaxAttributeValue());
            Health health = GetComponent <Health>();

            health.GainAttribute(health.GetMaxAttributeValue());
        }
    public void RestoreAttributes()
    {
        if (playerHealth != null)
        {
            playerHealth.GainAttribute(playerHealth.GetMaxAttributeValue());
        }

        if (playerMana != null)
        {
            playerMana.GainAttribute(playerMana.GetMaxAttributeValue());
        }

        GameObject followerObj = GameObject.FindGameObjectWithTag("Follower");

        if (followerObj != null)
        {
            Mana followerMana = followerObj.GetComponent <Mana>();
            followerMana.GainAttribute(followerMana.GetMaxAttributeValue());
        }
    }