using GFramework.Core.Abstractions.coroutine;
namespace GFramework.Core.coroutine;
///
/// 延迟等待指令,实现IYieldInstruction接口,用于协程中的时间延迟
///
/// 需要延迟的秒数
public sealed class Delay(double seconds) : IYieldInstruction
{
///
/// 剩余等待时间
///
private double _remaining = Math.Max(0, seconds);
///
/// 更新延迟计时器
///
/// 时间增量
public void Update(double deltaTime)
{
_remaining -= deltaTime;
}
///
/// 获取延迟是否完成
///
public bool IsDone => _remaining <= 0;
}