// Copyright (c) 2014 Orion Industries, zhiayang@gmail.com
// Licensed under the Apache License version 2.0

package Utilities

public data class DelayComponent(public val delay: Float)
{
	private var running: Float = this.delay
	public var elapsed: Boolean = false
		private set
		get()
		{
			if (this.$elapsed)
			{
				this.$elapsed = false
				return true
			}
			else
				return false
		}

	public fun tick(delta: Float)
	{
		this.running += delta
		if (this.running >= this.delay)
		{
			this.running = 0.0f
			this.elapsed = true
		}
	}

	public fun reset()
	{
		this.running = 0f
		this.elapsed = false
	}
}
