Ver Fonte

Updated WaitGameAction with new realtime timer

jamesperet há 3 anos atrás
pai
commit
3bdb80a625
3 ficheiros alterados com 17 adições e 4 exclusões
  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.
 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
         #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 float time = 1f;
+        [IconFoldoutGroup("@name", "Assets/Plugins/KairoEngine/Core/Editor/Icons/WaitGameActionIcon.png")]  public bool realtime = true;
         private float elapsedTime = 0f;
         private float elapsedTime = 0f;
 
 
         #endregion
         #endregion
@@ -47,12 +48,24 @@ namespace KairoEngine.Core.GameActions
             elapsedTime = 0f;
             elapsedTime = 0f;
             _done = false;
             _done = false;
             _started = true;
             _started = true;
+            if(realtime)
+            {
+                Timer.ExecuteRealTime(time * 1000, () => {
+                    _done = true;
+                });
+                // Timer.StartRealtime(time, () => {
+                //     _done = true;
+                // });
+            }
         }
         }
 
 
         public override void Update() 
         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()
         public override void Restart()

+ 1 - 1
package.json

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