package speiger.src.coreengine.math.smooth;

public class SmoothFloat
{
	protected float value;
	protected float target;
	protected float agility;
	
	public SmoothFloat(float agility) {
		this.agility = agility;
	}
	
	public SmoothFloat(float value, float agility) {
		this.value = value;
		target = value;
		this.agility = agility;
	}
	
	public boolean isDone() { return isDone(0.0005F); }
	public boolean isDone(float limit) { return Math.abs(target - value) <= limit; }
	public void update(float delta) { value += (target - value) * agility * delta; }
	
	public void setTarget(float value) { target = value; }
	public void addTarget(float value) { target += value; }
	
	public void forceFinish() { value = target; }
	
	public float getValue() { return value; }
	public float getTarget() { return target; }
}
