Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions _DOTween.Assembly/DOTween/Core/Easing/EaseManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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

/// <summary>
/// Returns a value between 0 and 1 (inclusive) based on the elapsed time and ease selected
/// </summary>
Expand Down
12 changes: 8 additions & 4 deletions _DOTween.Assembly/DOTween/Core/TweenManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down
16 changes: 10 additions & 6 deletions _DOTween.Assembly/DOTween/Plugins/Core/PathCore/Path.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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;
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion _DOTween.Assembly/DOTween/Plugins/Vector3ArrayPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down