public void SetMax(float value, bool setCurrent = false) { _max = value; if (_max < 0) { _max = 0; } if (setCurrent) { _current = _max; } UpdateModifiers(); OnMaxChanged?.Invoke(this); }
public CounterListener(OnValueChanged onValueChanged = null, OnMinChanged onMinChanged = null, OnMaxChanged onMaxChanged = null, OnStepChanged onStepChanged = null) { this.ActionOnValueChanged = onValueChanged == null ? new OnValueChanged((value) => { }) : onValueChanged; this.ActionOnMinChanged = onMinChanged == null ? new OnMinChanged((min) => { }) : onMinChanged; this.ActionOnMaxChanged = onMaxChanged == null ? new OnMaxChanged((max) => { }) : onMaxChanged; this.ActionOnStepChanged = onStepChanged == null ? new OnStepChanged((step) => { }) : onStepChanged; }