using System;
using UnityEngine;

namespace Leap.Unity
{
	[Serializable]
	public class SmoothedFloat
	{
		public void SetBlend(float blend, float deltaTime = 1f)
		{
			this.delay = deltaTime * blend / (1f - blend);
		}

		public float Update(float input, float deltaTime = 1f)
		{
			if (deltaTime > 0f && !this.reset)
			{
				float num = this.delay / deltaTime;
				float num2 = num / (1f + num);
				this.value = Mathf.Lerp(this.value, input, 1f - num2);
			}
			else
			{
				this.value = input;
				this.reset = false;
			}
			return this.value;
		}

		public float value;

		public float delay;

		public bool reset = true;
	}
}
