示例#1
0
    /// <summary>
    /// General change function for strength
    /// </summary>
    /// <param name="amountToChange">Value to change stat by. Can be positive or negative.</param>
    public void ChangeStrength(int amountToChange)
    {
        //Test if amount is positive to call increase
        if (amountToChange > 0)
        {
            IncreaseStrength(amountToChange);
        }

        //Test if amount is negative to call decrease
        if (amountToChange < 0)
        {
            DecreaseStrength(-amountToChange);//Change amount to its opposite(which should be positive) for decrease function
        }
        //Amount value 0 does nothing

        // Update basic attack's damage as well
        try
        {
            for (int i = 0; i < amountToChange; ++i)
            {
                _basicAttackRef.UpgradeDamage();
            }
        }
        catch
        {
            Debug.LogError("Could not update basic attack's damage for " + this.name);
        }
    }