Forráskód Böngészése

Updated WaitGameAction with new realtime timer

jamesperet 2 éve
szülő
commit
3bdb80a625
3 módosított fájl, 17 hozzáadás és 4 törlés
  1. 1 1
      Readme.md
  2. 15 2
      Runtime/GameActions/Actions/WaitGameAction.cs
  3. 1 1
      package.json

+ 1 - 1
Readme.md

@@ -1,4 +1,4 @@
-# 📦 KairoEngine.Core v0.1.7
+# 📦 KairoEngine.Core v0.1.8
 
 This contains the base code that other packages will use. It includes code for the module system, event system and common interfaces.
 

+ 15 - 2
Runtime/GameActions/Actions/WaitGameAction.cs

@@ -30,6 +30,7 @@ namespace KairoEngine.Core.GameActions
         #region ActionVariables
 
         [IconFoldoutGroup("@name", "Assets/Plugins/KairoEngine/Core/Editor/Icons/WaitGameActionIcon.png")]  public float time = 1f;
+        [IconFoldoutGroup("@name", "Assets/Plugins/KairoEngine/Core/Editor/Icons/WaitGameActionIcon.png")]  public bool realtime = true;
         private float elapsedTime = 0f;
 
         #endregion
@@ -47,12 +48,24 @@ namespace KairoEngine.Core.GameActions
             elapsedTime = 0f;
             _done = false;
             _started = true;
+            if(realtime)
+            {
+                Timer.ExecuteRealTime(time * 1000, () => {
+                    _done = true;
+                });
+                // Timer.StartRealtime(time, () => {
+                //     _done = true;
+                // });
+            }
         }
 
         public override void Update() 
         { 
-            elapsedTime += Time.deltaTime;
-            if(elapsedTime > time) _done = true;
+            if(!realtime)
+            {
+                elapsedTime += Time.deltaTime;
+                if(elapsedTime > time) _done = true;
+            }
         }
 
         public override void Restart()

+ 1 - 1
package.json

@@ -1,7 +1,7 @@
 {
   "name": "at.kairoscope.kairoengine.core",
   "displayName" : "KairoEngine Core",
-  "version": "0.1.7",
+  "version": "0.1.8",
   "unity": "2020.3",
   "description": "Base package for the KairoEngine library by Kairoscope",
   "repository": {