refactor: renamed WaitForSeconds to a more general WaitForTime class

This commit is contained in:
2026-03-08 12:53:02 +03:00
parent 35c7eb9578
commit 1418927c32
2 changed files with 14 additions and 10 deletions

View File

@@ -1,10 +0,0 @@
using System;
namespace Engine.Core;
public class WaitForSecondsYield(float seconds) : ICoroutineYield
{
private readonly DateTime triggerTime = DateTime.UtcNow.AddSeconds(seconds);
public bool Yield() => DateTime.UtcNow < triggerTime;
}

View File

@@ -0,0 +1,14 @@
using System;
namespace Engine.Core;
public class WaitForTimeYield(float seconds = 0f, float milliseconds = 0f, float minutes = 0f, float hours = 0f) : ICoroutineYield
{
private readonly DateTime triggerTime = DateTime.UtcNow
.AddHours(hours)
.AddMinutes(minutes)
.AddSeconds(seconds)
.AddMilliseconds(milliseconds);
public bool Yield() => DateTime.UtcNow < triggerTime;
}