refactor: renamed WaitForSeconds to a more general WaitForTime class
This commit is contained in:
@@ -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;
|
|
||||||
}
|
|
||||||
14
Engine.Core/Systems/Yields/WaitForTimeYield.cs
Normal file
14
Engine.Core/Systems/Yields/WaitForTimeYield.cs
Normal 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;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user