GeWuYou ddbf7af572 feat(coroutine): 添加完整的协程系统实现
- 实现了协程调度器和句柄管理机制
- 添加了多种等待指令包括延时、帧数、条件等待等
- 创建了协程辅助方法和扩展功能
- 集成了Godot引擎的时间源和生命周期管理
- 实现了协程的暂停、恢复、终止等控制功能
- 添加了协程标签管理和按标签批量操作功能
- 提供了与Godot节点生命周期绑定的取消机制
2026-01-21 20:34:10 +08:00

26 lines
726 B
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using GFramework.Core.Abstractions.coroutine;
namespace GFramework.Core.coroutine;
/// <summary>
/// 表示等待一帧的等待指令实现
/// 实现IYieldInstruction接口用于协程中等待一个游戏帧的执行
/// </summary>
public sealed class WaitOneFrame : IYieldInstruction
{
private bool _done;
/// <summary>
/// 更新方法在每一帧被调用时将完成状态设置为true
/// </summary>
/// <param name="deltaTime">时间间隔,表示当前帧与上一帧的时间差</param>
public void Update(double deltaTime)
{
_done = true;
}
/// <summary>
/// 获取当前等待指令是否已完成
/// </summary>
public bool IsDone => _done;
}