WaitForSeconds.cs 395 B

1234567891011121314
  1. namespace UnityAsync
  2. {
  3. public struct WaitForSeconds : IAwaitInstruction
  4. {
  5. readonly float finishTime;
  6. bool IAwaitInstruction.IsCompleted() => AsyncManager.CurrentTime >= finishTime;
  7. /// <summary>
  8. /// Waits for the specified number of seconds to pass before continuing.
  9. /// </summary>
  10. public WaitForSeconds(float seconds) => finishTime = AsyncManager.CurrentTime + seconds;
  11. }
  12. }