WaitForSecondsRealtime.cs 438 B

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