Пример #1
0
    public bool AddModifier(CRModifier newModifier)
    {
        if (newModifier == null)
        {
            Debug.LogError ("Unable to add null modifier");
            return false;
        }

        if (_modifiers.Contains(newModifier))
        {
            Debug.LogError ("Modifier has already been added");
            return false;
        }

        //note: the array is kept ordered by enum value
        int i = 0;
        foreach (CRModifier modifier in _modifiers)
        {
            if (newModifier.modifierType < modifier.modifierType)
                break;

            i++;
        }

        _modifiers.Insert(i, newModifier);

        if (null != OnAddModifier)
            OnAddModifier(this, newModifier);

        return true;
    }
Пример #2
0
 void HandleMaxOnRemoveModifier(CRValue sender, CRModifier modifier)
 {
     //maintain the same percentage when the max value changes
     currentValue = max.activeValue * _percent;
 }
Пример #3
0
    public bool RemoveModifier(CRModifier modifier)
    {
        _modifiers.Remove(modifier);

        if (null != OnRemoveModifier)
            OnRemoveModifier(this, modifier);

        return true;
    }