lcy
8 天以前 3b64befcd8b2ab5abef1a33c5c8f73a6b245aff0
Main/Utility/UniTaskExtension.cs
@@ -34,4 +34,25 @@
    {
        DelayFrameInternal(1, action);
    }
    public static void DelayTime(this GameObject go, float time, Action action)
    {
        DelayTimeInternal(time, action);
    }
    public static void DelayTime(this Component cmp, float time, Action action)
    {
        DelayTimeInternal(time, action);
    }
    private async static UniTask DelayTimeInternal(float time, Action action)
    {
        if (time <= 0f)
        {
            action?.Invoke();
            return;
        }
        await UniTask.Delay(TimeSpan.FromSeconds(time));
        action?.Invoke();
    }
}