Exemple #1
0
    /// <summary>
    /// Sums up the stat boosts the character has active at the moment.
    /// </summary>
    private void GenerateBoosts()
    {
        currentBoost = new Boost();

        Boost mergeBoost = new Boost();

        mergeBoost.boostType = BoostType.DECREASE;
        for (int i = 0; i < boosts.Count; i++)
        {
            if (boosts[i].boostType == BoostType.DECREASE)
            {
                mergeBoost.MergeBoost(boosts[i]);
                boosts.RemoveAt(i);
                i--;
                mergeBoost.ActivateBoost();
            }
        }
        if (mergeBoost.IsActive())
        {
            boosts.Add(mergeBoost);
        }

        for (int i = 0; i < boosts.Count; i++)
        {
            currentBoost.AddBoost(boosts[i]);
        }
    }
Exemple #2
0
    /// <summary>
    /// Receives the given buff and adds it to the current stats.
    /// isBuff indicates if it's a buff or debuff.
    /// useAnim indicates if the buff gaining should also play an animation.
    /// </summary>
    /// <param name="boost"></param>
    /// <param name="isBuff"></param>
    /// <param name="useAnim"></param>
    public virtual void ReceiveBuff(Boost boost, bool isBuff, bool useAnim)
    {
        if (!IsAlive())
        {
            return;
        }

        boost.ActivateBoost();
        stats.boosts.Add(boost);
        stats.CalculateStats();
        if (useAnim)
        {
            StartCoroutine(BoostDisplay(isBuff));
        }
    }