projectEli/Assets/NeoFPS/Core/Utilities/Waitable.cs

45 lines
1001 B
C#
Raw Normal View History

2022-11-07 01:28:33 +00:00
using System.Collections;
using UnityEngine;
namespace NeoFPS
{
public abstract class Waitable : IEnumerator
{
public bool isComplete
{
get { return CheckComplete (); }
}
public bool MoveNext() { return !CheckComplete (); }
protected abstract bool CheckComplete ();
#region IGNORE THESE
public object Current { get { return null; } }
public void Reset() { Debug.Log ("Waitable.Reset() got called. What was the situation?"); }
#endregion
}
public abstract class Waitable<ResultType> : IEnumerator
{
public bool isComplete
{
get { return CheckComplete (); }
}
public ResultType result
{
get { return GetResult (); }
}
public bool MoveNext() { return !CheckComplete (); }
protected abstract bool CheckComplete ();
protected abstract ResultType GetResult ();
#region IGNORE THESE
public object Current { get { return null; } }
public void Reset() { Debug.Log ("Waitable.Reset() got called. What was the situation?"); }
#endregion
}
}