using GFramework.Game.Abstractions.coroutine; namespace GFramework.Game.coroutine; /// /// 表示一个等待指定秒数的时间延迟指令 /// /// 需要等待的秒数 public class WaitForSeconds(float seconds) : IYieldInstruction { private float _elapsed; public bool IsDone { get; private set; } /// /// 更新时间进度,当累计时间达到指定秒数时标记完成 /// /// 自上次更新以来经过的时间(秒) public void Update(float deltaTime) { if (IsDone) return; _elapsed += deltaTime; if (_elapsed >= seconds) IsDone = true; } }