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

[BUGFIX] Fixed DOJump not working correctly with .NET 4.6

This commit is contained in:
Demigiant 2018-02-04 11:36:28 +01:00
parent c1c98814e9
commit 96065a6e65
44 changed files with 32 additions and 33 deletions

View File

@ -1 +1 @@
m_EditorVersion: 5.6.3p4 m_EditorVersion: 5.6.5f1

View File

@ -32,7 +32,7 @@ namespace DG.Tweening
public class DOTween public class DOTween
{ {
/// <summary>DOTween's version</summary> /// <summary>DOTween's version</summary>
public static readonly string Version = "1.1.690"; public static readonly string Version = "1.1.695";
/////////////////////////////////////////////// ///////////////////////////////////////////////
// Options //////////////////////////////////// // Options ////////////////////////////////////

View File

@ -470,15 +470,6 @@ namespace DG.Tweening
s.Append(DOTween.To(() => target.position, target.MovePosition, new Vector3(endValue.x, 0, 0), duration) s.Append(DOTween.To(() => target.position, target.MovePosition, new Vector3(endValue.x, 0, 0), duration)
#endif #endif
.SetOptions(AxisConstraint.X, snapping).SetEase(Ease.Linear) .SetOptions(AxisConstraint.X, snapping).SetEase(Ease.Linear)
.OnUpdate(() => {
if (!offsetYSet) {
offsetYSet = true;
offsetY = s.isRelative ? endValue.y : endValue.y - startPosY;
}
Vector3 pos = target.position;
pos.y += DOVirtual.EasedValue(0, offsetY, s.ElapsedDirectionalPercentage(), Ease.OutQuad);
target.MovePosition(pos);
})
#if COMPATIBLE #if COMPATIBLE
).Join(DOTween.To(() => target.position, x => target.MovePosition(x.value), new Vector3(0, 0, endValue.z), duration) ).Join(DOTween.To(() => target.position, x => target.MovePosition(x.value), new Vector3(0, 0, endValue.z), duration)
#else #else
@ -492,7 +483,16 @@ namespace DG.Tweening
#endif #endif
.SetOptions(AxisConstraint.Y, snapping).SetEase(Ease.OutQuad) .SetOptions(AxisConstraint.Y, snapping).SetEase(Ease.OutQuad)
.SetLoops(numJumps * 2, LoopType.Yoyo).SetRelative() .SetLoops(numJumps * 2, LoopType.Yoyo).SetRelative()
).SetTarget(target).SetEase(DOTween.defaultEaseType); ).SetTarget(target).SetEase(DOTween.defaultEaseType)
.OnUpdate(() => {
if (!offsetYSet) {
offsetYSet = true;
offsetY = s.isRelative ? endValue.y : endValue.y - startPosY;
}
Vector3 pos = target.position;
pos.y += DOVirtual.EasedValue(0, offsetY, s.ElapsedDirectionalPercentage(), Ease.OutQuad);
target.MovePosition(pos);
});
return s; return s;
} }
@ -974,25 +974,24 @@ namespace DG.Tweening
float offsetY = -1; float offsetY = -1;
bool offsetYSet = false; bool offsetYSet = false;
Sequence s = DOTween.Sequence(); Sequence s = DOTween.Sequence();
s.Append(DOTween.To(() => target.position, x => target.position = x, new Vector3(endValue.x, 0, 0), duration) s.Append(DOTween.To(() => target.position, x => target.position = x, new Vector3(endValue.x, 0, 0), duration)
.SetOptions(AxisConstraint.X, snapping).SetEase(Ease.Linear) .SetOptions(AxisConstraint.X, snapping).SetEase(Ease.Linear)
.OnUpdate(() => {
if (!offsetYSet) {
offsetYSet = true;
offsetY = s.isRelative ? endValue.y : endValue.y - startPosY;
}
Vector3 pos = target.position;
pos.y += DOVirtual.EasedValue(0, offsetY, s.ElapsedDirectionalPercentage(), Ease.OutQuad);
target.position = pos;
})
).Join(DOTween.To(() => target.position, x => target.position = x, new Vector3(0, 0, endValue.z), duration) ).Join(DOTween.To(() => target.position, x => target.position = x, new Vector3(0, 0, endValue.z), duration)
.SetOptions(AxisConstraint.Z, snapping).SetEase(Ease.Linear) .SetOptions(AxisConstraint.Z, snapping).SetEase(Ease.Linear)
).Join(DOTween.To(() => target.position, x => target.position = x, new Vector3(0, jumpPower, 0), duration / (numJumps * 2)) ).Join(DOTween.To(() => target.position, x => target.position = x, new Vector3(0, jumpPower, 0), duration / (numJumps * 2))
.SetOptions(AxisConstraint.Y, snapping).SetEase(Ease.OutQuad).SetRelative() .SetOptions(AxisConstraint.Y, snapping).SetEase(Ease.OutQuad).SetRelative()
.SetLoops(numJumps * 2, LoopType.Yoyo) .SetLoops(numJumps * 2, LoopType.Yoyo)
).SetTarget(target).SetEase(DOTween.defaultEaseType); ).SetTarget(target).SetEase(DOTween.defaultEaseType)
.OnUpdate(() => {
if (!offsetYSet) {
offsetYSet = true;
offsetY = s.isRelative ? endValue.y : endValue.y - startPosY;
}
Vector3 pos = target.position;
pos.y += DOVirtual.EasedValue(0, offsetY, s.ElapsedDirectionalPercentage(), Ease.OutQuad);
target.position = pos;
});
return s; return s;
} }
/// <summary>Tweens a Transform's localPosition to the given value, while also applying a jump effect along the Y axis. /// <summary>Tweens a Transform's localPosition to the given value, while also applying a jump effect along the Y axis.
@ -1012,21 +1011,21 @@ namespace DG.Tweening
Sequence s = DOTween.Sequence(); Sequence s = DOTween.Sequence();
s.Append(DOTween.To(() => target.localPosition, x => target.localPosition = x, new Vector3(endValue.x, 0, 0), duration) s.Append(DOTween.To(() => target.localPosition, x => target.localPosition = x, new Vector3(endValue.x, 0, 0), duration)
.SetOptions(AxisConstraint.X, snapping).SetEase(Ease.Linear) .SetOptions(AxisConstraint.X, snapping).SetEase(Ease.Linear)
.OnUpdate(() => {
if (!offsetYSet) {
offsetYSet = false;
offsetY = s.isRelative ? endValue.y : endValue.y - startPosY;
}
Vector3 pos = target.localPosition;
pos.y += DOVirtual.EasedValue(0, offsetY, s.ElapsedDirectionalPercentage(), Ease.OutQuad);
target.localPosition = pos;
})
).Join(DOTween.To(() => target.localPosition, x => target.localPosition = x, new Vector3(0, 0, endValue.z), duration) ).Join(DOTween.To(() => target.localPosition, x => target.localPosition = x, new Vector3(0, 0, endValue.z), duration)
.SetOptions(AxisConstraint.Z, snapping).SetEase(Ease.Linear) .SetOptions(AxisConstraint.Z, snapping).SetEase(Ease.Linear)
).Join(DOTween.To(() => target.localPosition, x => target.localPosition = x, new Vector3(0, jumpPower, 0), duration / (numJumps * 2)) ).Join(DOTween.To(() => target.localPosition, x => target.localPosition = x, new Vector3(0, jumpPower, 0), duration / (numJumps * 2))
.SetOptions(AxisConstraint.Y, snapping).SetEase(Ease.OutQuad).SetRelative() .SetOptions(AxisConstraint.Y, snapping).SetEase(Ease.OutQuad).SetRelative()
.SetLoops(numJumps * 2, LoopType.Yoyo) .SetLoops(numJumps * 2, LoopType.Yoyo)
).SetTarget(target).SetEase(DOTween.defaultEaseType); ).SetTarget(target).SetEase(DOTween.defaultEaseType)
.OnUpdate(() => {
if (!offsetYSet) {
offsetYSet = false;
offsetY = s.isRelative ? endValue.y : endValue.y - startPosY;
}
Vector3 pos = target.localPosition;
pos.y += DOVirtual.EasedValue(0, offsetY, s.ElapsedDirectionalPercentage(), Ease.OutQuad);
target.localPosition = pos;
});
return s; return s;
} }

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.