diff --git a/_DOTween.Assembly/DOTween/Core/Easing/EaseManager.cs b/_DOTween.Assembly/DOTween/Core/Easing/EaseManager.cs index 270d4a60..57bb6f8d 100644 --- a/_DOTween.Assembly/DOTween/Core/Easing/EaseManager.cs +++ b/_DOTween.Assembly/DOTween/Core/Easing/EaseManager.cs @@ -47,6 +47,9 @@ public static class EaseManager const float _PiOver2 = Mathf.PI * 0.5f; const float _TwoPi = Mathf.PI * 2; + //TODO: Comparisons should be use 'Epsilon' value. Like : Math.Abs(A - B) < Epsilon + //https://stackoverflow.com/questions/1398753/comparing-double-values-in-c-sharp + /// /// Returns a value between 0 and 1 (inclusive) based on the elapsed time and ease selected /// diff --git a/_DOTween.Assembly/DOTween/Core/TweenManager.cs b/_DOTween.Assembly/DOTween/Core/TweenManager.cs index 345dfd29..1a3ed3ae 100644 --- a/_DOTween.Assembly/DOTween/Core/TweenManager.cs +++ b/_DOTween.Assembly/DOTween/Core/TweenManager.cs @@ -351,6 +351,7 @@ internal static void Update(UpdateType updateType, float deltaTime, float indepe 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 (!t.delayComplete) { tDeltaTime = t.UpdateDelay(t.elapsedDelay + tDeltaTime); if (tDeltaTime <= -1) { @@ -389,7 +390,7 @@ internal static void Update(UpdateType updateType, float deltaTime, float indepe toPosition += t.duration; toCompletedLoops--; } - if (toCompletedLoops < 0 || wasEndPosition && toCompletedLoops < 1) { + if (toCompletedLoops < 0 || (wasEndPosition && toCompletedLoops < 1)) { // Result is equivalent to a rewind, so set values according to it toPosition = 0; toCompletedLoops = wasEndPosition ? 1 : 0; @@ -448,21 +449,24 @@ internal static int FilteredOperation(OperationType operationType, FilterType fi isFilterCompliant = true; break; case FilterType.TargetOrId: - isFilterCompliant = id.Equals(t.id) || id.Equals(t.target); + isFilterCompliant = t.id != null && id.Equals(t.id) || t.target != null && id.Equals(t.target); break; case FilterType.TargetAndId: - isFilterCompliant = id.Equals(t.id) && optionalObj != null && optionalObj.Equals(t.target); + isFilterCompliant = t.id != null && t.target != null && optionalObj != null && id.Equals(t.id) && optionalObj.Equals(t.target); break; case FilterType.AllExceptTargetsOrIds: isFilterCompliant = true; for (int c = 0; c < optionalArrayLen; ++c) { object objId = optionalArray[c]; - if (objId.Equals(t.id) || objId.Equals(t.target)) { + if (t.id != null && objId.Equals(t.id) || t.target != null && objId.Equals(t.target)) { isFilterCompliant = false; break; } } break; + case FilterType.DOGetter: + //TODO: Remember me + break; } if (isFilterCompliant) { switch (operationType) { diff --git a/_DOTween.Assembly/DOTween/Plugins/Core/PathCore/Path.cs b/_DOTween.Assembly/DOTween/Plugins/Core/PathCore/Path.cs index e0080b0a..b67d1a99 100644 --- a/_DOTween.Assembly/DOTween/Plugins/Core/PathCore/Path.cs +++ b/_DOTween.Assembly/DOTween/Plugins/Core/PathCore/Path.cs @@ -156,9 +156,11 @@ internal static Vector3[] GetDrawPoints(Path p, int drawSubdivisionsXSegment) int gizmosSubdivisions = wpsCount * drawSubdivisionsXSegment; Vector3[] drawPoints = new Vector3[gizmosSubdivisions + 1]; for (int i = 0; i <= gizmosSubdivisions; ++i) { - float perc = i / (float)gizmosSubdivisions; - Vector3 wp = p.GetPoint(perc); - drawPoints[i] = wp; + if((float)gizmosSubdivisions != 0) { + float perc = i / (float)gizmosSubdivisions; + Vector3 wp = p.GetPoint(perc); + drawPoints[i] = wp; + } } return drawPoints; } @@ -173,9 +175,11 @@ internal static void RefreshNonLinearDrawWps(Path p) if (p.nonLinearDrawWps == null || p.nonLinearDrawWps.Length != gizmosSubdivisions + 1) p.nonLinearDrawWps = new Vector3[gizmosSubdivisions + 1]; for (int i = 0; i <= gizmosSubdivisions; ++i) { - float perc = i / (float)gizmosSubdivisions; - Vector3 wp = p.GetPoint(perc); - p.nonLinearDrawWps[i] = wp; + if ((float) gizmosSubdivisions != 0) { + float perc = i / (float)gizmosSubdivisions; + Vector3 wp = p.GetPoint(perc); + p.nonLinearDrawWps[i] = wp; + } } } diff --git a/_DOTween.Assembly/DOTween/Plugins/Vector3ArrayPlugin.cs b/_DOTween.Assembly/DOTween/Plugins/Vector3ArrayPlugin.cs index 07fd6721..efb6a18e 100644 --- a/_DOTween.Assembly/DOTween/Plugins/Vector3ArrayPlugin.cs +++ b/_DOTween.Assembly/DOTween/Plugins/Vector3ArrayPlugin.cs @@ -104,7 +104,7 @@ public override void EvaluateAndApply(Vector3ArrayOptions options, Tween t, bool } // Evaluate float easeVal = EaseManager.Evaluate(t.easeType, t.customEase, segmentElapsed, segmentDuration, t.easeOvershootOrAmplitude, t.easePeriod); - Vector3 res; + Vector3 res = Vector3.zero; switch (options.axisConstraint) { case AxisConstraint.X: res = getter();