public void Remove(IGiveBuff f, out bool clear) { ValueBuff ee = Find(f); float oldValue = GetValue; if (ee != null) { froms.Remove(ee); } clear = froms.Count == 0; float newValue; if (clear) { newValue = 0; } else { newValue = GetValue; } OnValueChanged?.Invoke(Type, new ChangesValue(oldValue, newValue)); }
public void Register(IGiveBuff give, float value) { ValueBuff vlb = null; if (give != null && give as UnityEngine.Object != null) { vlb = Find(give); } float oldValue = GetValue; if (vlb == null) { froms.Add(new ValueBuff(give, value)); } else { Debug.Log("Da ton tai give"); vlb.value = value; } float newValue = GetValue; OnValueChanged?.Invoke(Type, new ChangesValue(oldValue, newValue)); }