From 871594462e82d6bc1341918d39e11ab036d59563 Mon Sep 17 00:00:00 2001
From: yyl <yyl>
Date: 星期四, 18 九月 2025 19:26:28 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.1.20:10010/r/Project_SG_scripts

---
 Main/Utility/UniTaskExtension.cs |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/Main/Utility/UniTaskExtension.cs b/Main/Utility/UniTaskExtension.cs
index 8ba915f..2ff6255 100644
--- a/Main/Utility/UniTaskExtension.cs
+++ b/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();
+    }
 }
\ No newline at end of file

--
Gitblit v1.8.0