Files
Continentis/Assets/Scripts/SLSUtilities/CommandQueue/Examples/Cmd_WaitAndLog.cs
SoulliesOfficial d09b58fd80 架构大更
2026-03-20 11:56:50 -04:00

26 lines
767 B
C#

using System;
using Cysharp.Threading.Tasks;
using SLSFramework.General;
using UnityEngine;
namespace SLSFramework.General
{
/// <summary>等待指定秒数后在控制台输出一条信息。</summary>
public class Cmd_WaitAndLog : CommandBase
{
private readonly float duration;
private readonly string message;
public Cmd_WaitAndLog(float duration, string message)
{
this.duration = duration;
this.message = message;
}
protected override async UniTask ExecuteAsync(CommandContext outerContext)
{
await UniTask.Delay(TimeSpan.FromSeconds(duration));
Debug.Log($"[Cmd_WaitAndLog] 等待 {duration} 秒后... 输出: '{message}'");
}
}
}