From 732aece2ea5a419a94a0f5ece29f9c11eface70c Mon Sep 17 00:00:00 2001 From: Inspiaaa Date: Thu, 5 Sep 2024 19:11:16 +0200 Subject: [PATCH] Expose ignoreTimeScale in WaitCoroutine --- src/Co.cs | 4 ++-- src/Coroutines/WaitDelayCoroutine.cs | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Co.cs b/src/Co.cs index b199701..03c6c75 100644 --- a/src/Co.cs +++ b/src/Co.cs @@ -118,8 +118,8 @@ public static SequentialCoroutine Sequence( => new SequentialCoroutine(processMode, runMode, coroutines); - public static WaitDelayCoroutine Wait(float delay, CoRunMode runMode = CoRunMode.Inherit) - => new WaitDelayCoroutine(delay, runMode); + public static WaitDelayCoroutine Wait(float delay, bool ignoreTimeScale = false, CoRunMode runMode = CoRunMode.Inherit) + => new WaitDelayCoroutine(delay, ignoreTimeScale, runMode); public static WaitWhileCoroutine WaitWhile( diff --git a/src/Coroutines/WaitDelayCoroutine.cs b/src/Coroutines/WaitDelayCoroutine.cs index 34fcf7e..3a0ce4a 100644 --- a/src/Coroutines/WaitDelayCoroutine.cs +++ b/src/Coroutines/WaitDelayCoroutine.cs @@ -8,19 +8,21 @@ namespace HCoroutines; public class WaitDelayCoroutine : CoroutineBase { private readonly float delay; + private readonly bool ignoreTimeScale; private SceneTreeTimer timer; private float remainingTime; - public WaitDelayCoroutine(float delay, CoRunMode runMode = CoRunMode.Inherit) + public WaitDelayCoroutine(float delay, bool ignoreTimeScale = false, CoRunMode runMode = CoRunMode.Inherit) : base(CoProcessMode.Inherit, runMode) { this.delay = delay; + this.ignoreTimeScale = ignoreTimeScale; } protected override void OnStart() { - timer = Manager.GetTree().CreateTimer(delay); + timer = Manager.GetTree().CreateTimer(delay, ignoreTimeScale: ignoreTimeScale); timer.Timeout += Kill; }