Example #1
0
        public void Gain(int _amount, ISource _source)
        {
            int prev = current;

            current += _amount;
            current  = Mathf.Clamp(current, min, max);

            if (current != prev)
            {
                OnResourceGained?.Invoke(current - prev, _source);
                OnChanged?.Invoke(prev, current);
                OnFillValueChanged?.Invoke();
            }
        }
 protected virtual void TriggerOnResourceGained(int _amount, ISource _source) => OnResourceGained?.Invoke(_amount, _source);