public void updateValue(float old, float inc, float max) { this.now = old + inc; this.max = max; frontBar.reset(); incBar.reset(); if (now != incBar.getNewValue()) { frontBar.updateValue(old, max); isActive = true; } }
private void updateBar() { if (!isActive) { return; } float incNewData = frontBar.getNewValue() / frontBar.getMaxValue(); if (Mathf.Abs(incNewData - currentBarValue) < 0.005f) { currentBarValue = incNewData; isActive = false; incBar.updateValue(now, max); } if (incNewData != currentBarValue) { currentBarValue = Mathf.Lerp(currentBarValue, incNewData, Time.deltaTime * 10); } }