Exemplo n.º 1
0
 public void Decrement(IAttributeCollection attributes, EventOnAttributeChange onAttributeChange, int t = 1)
 {
     foreach (KeyValuePair <AttributeType, float> attribute in attributes)
     {
         Modify(attribute.Key, -attribute.Value, onAttributeChange, t);
     }
 }
Exemplo n.º 2
0
    public void Modify(AttributeType type, float value, EventOnAttributeChange onAttributeChange, int t = 1)
    {
        float previousValue;

        if (!attributes.ContainsKey(type))
        {
            previousValue = 0;
            attributes.Add(type, value * t);
        }
        else
        {
            previousValue     = attributes[type];
            attributes[type] += value * t;
        }

        onAttributeChange.Invoke(type, previousValue, attributes[type]);
    }
Exemplo n.º 3
0
    public void Set(AttributeType type, float value, EventOnAttributeChange onAttributeChange)
    {
        if (!attributes.ContainsKey(type))
        {
            if (value != 0)
            {
                attributes.Add(type, value);

                onAttributeChange.Invoke(type, 0, value);
            }
        }
        else
        {
            float previousValue = attributes[type];

            if (value != previousValue)
            {
                attributes[type] = value;

                onAttributeChange.Invoke(type, previousValue, value);
            }
        }
    }