Пример #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();
            }
        }
Пример #2
0
 protected virtual void TriggerOnResourceGained(int _amount, ISource _source) => OnResourceGained?.Invoke(_amount, _source);