1
0
mirror of https://github.com/Cardidi/dotween-upm-fork.git synced 2026-02-04 14:24:55 +08:00

[BUGFIX] Fixed negative timeScales not working anymore

This commit is contained in:
Demigiant 2018-12-21 13:26:45 +01:00
parent e848c1343e
commit 9fabddb030
15 changed files with 8 additions and 9 deletions

View File

@ -13,13 +13,10 @@ public class TempTests : BrainBase
{
public Transform target;
void Start()
IEnumerator Start()
{
int tot = 10;
while (tot > 0) {
target.DOMoveX(1, 5f).SetId("TW" + tot).SetLoops(-1, LoopType.Yoyo);
DOTween.Sequence().Append(target.DOMoveY(2, 3f).SetId("INN" + tot)).SetLoops(-1, LoopType.Yoyo).SetId("SEQ" + tot);
tot--;
}
target.DOMoveX(4, 10);
yield return new WaitForSeconds(2);
DOTween.timeScale = -1;
}
}

View File

@ -17,6 +17,7 @@ namespace DG.Tweening.Core
const int _DefaultMaxTweeners = 200;
const int _DefaultMaxSequences = 50;
const string _MaxTweensReached = "Max Tweens reached: capacity has automatically been increased from #0 to #1. Use DOTween.SetTweensCapacity to set it manually at startup";
const float _EpsilonVsTimeCheck = 0.000001f;
internal static bool isUnityEditor;
internal static bool isDebugBuild;
@ -383,7 +384,8 @@ namespace DG.Tweening.Core
if (!t.isPlaying) continue;
t.creationLocked = true; // Lock tween creation methods from now on
float tDeltaTime = (t.isIndependentUpdate ? independentTime : deltaTime) * t.timeScale;
if (tDeltaTime <= 0) continue; // Skip update in case time is 0
// if (tDeltaTime <= 0) continue; // Skip update in case time is 0 (commented in favor of next line because this prevents negative timeScales)
if (tDeltaTime < _EpsilonVsTimeCheck && tDeltaTime > -_EpsilonVsTimeCheck) continue; // Skip update in case time is approximately 0
if (!t.delayComplete) {
tDeltaTime = t.UpdateDelay(t.elapsedDelay + tDeltaTime);
if (tDeltaTime <= -1) {

View File

@ -32,7 +32,7 @@ namespace DG.Tweening
public class DOTween
{
/// <summary>DOTween's version</summary>
public static readonly string Version = "1.2.150"; // Last version before modules: 1.1.755
public static readonly string Version = "1.2.155"; // Last version before modules: 1.1.755
///////////////////////////////////////////////
// Options ////////////////////////////////////

Binary file not shown.