using UnityEngine;
using System;
using System.Collections.Generic;
using System.Threading;

public class WaitForRealSeconds : IYieldInstruction
{
	private Timer mTimer = null;
	
	public WaitForRealSeconds(float seconds)
	{
		//IsFinished = false;
		mTimer = new Timer((state) =>
		{
			IsFinished = true;
			mTimer.Dispose();
		}, null, (int)(seconds * 1000), Timeout.Infinite);
	}
	
	#region IYieldInstruction implementation
	public void Cancel ()
	{
		IsFinished = true;
	}

	public bool IsFinished
	{
		get;
		private set;
	}
	
	#endregion

}