diff --git a/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween.XML b/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween.XML index f73f235..b4cace0 100644 --- a/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween.XML +++ b/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween.XML @@ -757,7 +757,11 @@ Returns the elapsed percentage (0 to 1) of this tween (delays exluded) If TRUE returns the elapsed percentage since startup loops included, - otherwise the elapsed percentage within the current loop cycle + otherwise the elapsed percentage within the current loop cycle + + + Returns the elapsed percentage (0 to 1) of this tween (delays exluded), + based on a single loop, and calculating eventual backwards Yoyo loops as 1 to 0 instead of 0 to 1 Returns FALSE if this tween has been killed. @@ -1054,11 +1058,12 @@ Eventual axis constraint for the rotation The vector that defines in which direction up is (default: Vector3.up) - + Tweens a Rigidbody's X/Z position to the given value, while also applying a jump effect along the Y axis. Returns a Sequence instead of a Tweener. Also stores the Rigidbody as the tween's target so it can be used for filtered operations The X/Z end value to reach, and the Y jump height + Power of the jump (the max height of the jump is represented by this plus the final Y offset) Total number of jumps The duration of the tween If TRUE the tween will smoothly snap all values to integers @@ -1247,20 +1252,22 @@ Indicates how much the shake will be random (0 to 180 - values higher than 90 kind of suck, so beware). Setting it to 0 will shake along a single direction. - - Tweens a Transform's X/Z position to the given value, while also applying a jump effect along the Y axis. + + Tweens a Transform's position to the given value, while also applying a jump effect along the Y axis. Returns a Sequence instead of a Tweener. Also stores the transform as the tween's target so it can be used for filtered operations - The X/Z end value to reach, and the Y jump height + The end value to reach + Power of the jump (the max height of the jump is represented by this plus the final Y offset) Total number of jumps The duration of the tween If TRUE the tween will smoothly snap all values to integers - + Tweens a Transform's X/Z localPosition to the given value, while also applying a jump effect along the Y axis. Returns a Sequence instead of a Tweener. Also stores the transform as the tween's target so it can be used for filtered operations The X/Z end value to reach, and the Y jump height + Power of the jump (the max height of the jump is represented by this plus the final Y offset) Total number of jumps The duration of the tween If TRUE the tween will smoothly snap all values to integers diff --git a/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween.dll b/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween.dll index 41a77ab..6ff8eab 100644 Binary files a/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween.dll and b/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween.dll differ diff --git a/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween.dll.mdb b/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween.dll.mdb index 68b7d65..68ddecb 100644 Binary files a/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween.dll.mdb and b/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween.dll.mdb differ diff --git a/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween43.dll b/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween43.dll index 96ca254..44bd8f8 100644 Binary files a/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween43.dll and b/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween43.dll differ diff --git a/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween43.dll.mdb b/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween43.dll.mdb index 55838b1..fdb82d3 100644 Binary files a/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween43.dll.mdb and b/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween43.dll.mdb differ diff --git a/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween43.xml b/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween43.xml index 25e4a2e..2264412 100644 --- a/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween43.xml +++ b/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween43.xml @@ -43,11 +43,12 @@ Also stores the Rigidbody2D as the tween's target so it can be used for filtered operations The end value to reachThe duration of the tween - + Tweens a Rigidbody2D's X position to the given value, while also applying a jump effect along the Y axis. Returns a Sequence instead of a Tweener. Also stores the Rigidbody2D as the tween's target so it can be used for filtered operations The X end value to reach, and the Y jump height + Power of the jump (the max height of the jump is represented by this plus the final Y offset) Total number of jumps The duration of the tween If TRUE the tween will smoothly snap all values to integers diff --git a/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween46.dll b/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween46.dll index efdccb9..8c91ebb 100644 Binary files a/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween46.dll and b/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween46.dll differ diff --git a/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween46.dll.mdb b/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween46.dll.mdb index 38b6995..df2b329 100644 Binary files a/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween46.dll.mdb and b/UnityCompatibilityTests.Unity35/Assets/Demigiant/DOTween/DOTween46.dll.mdb differ diff --git a/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween.XML b/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween.XML index f73f235..b4cace0 100644 --- a/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween.XML +++ b/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween.XML @@ -757,7 +757,11 @@ Returns the elapsed percentage (0 to 1) of this tween (delays exluded) If TRUE returns the elapsed percentage since startup loops included, - otherwise the elapsed percentage within the current loop cycle + otherwise the elapsed percentage within the current loop cycle + + + Returns the elapsed percentage (0 to 1) of this tween (delays exluded), + based on a single loop, and calculating eventual backwards Yoyo loops as 1 to 0 instead of 0 to 1 Returns FALSE if this tween has been killed. @@ -1054,11 +1058,12 @@ Eventual axis constraint for the rotation The vector that defines in which direction up is (default: Vector3.up) - + Tweens a Rigidbody's X/Z position to the given value, while also applying a jump effect along the Y axis. Returns a Sequence instead of a Tweener. Also stores the Rigidbody as the tween's target so it can be used for filtered operations The X/Z end value to reach, and the Y jump height + Power of the jump (the max height of the jump is represented by this plus the final Y offset) Total number of jumps The duration of the tween If TRUE the tween will smoothly snap all values to integers @@ -1247,20 +1252,22 @@ Indicates how much the shake will be random (0 to 180 - values higher than 90 kind of suck, so beware). Setting it to 0 will shake along a single direction. - - Tweens a Transform's X/Z position to the given value, while also applying a jump effect along the Y axis. + + Tweens a Transform's position to the given value, while also applying a jump effect along the Y axis. Returns a Sequence instead of a Tweener. Also stores the transform as the tween's target so it can be used for filtered operations - The X/Z end value to reach, and the Y jump height + The end value to reach + Power of the jump (the max height of the jump is represented by this plus the final Y offset) Total number of jumps The duration of the tween If TRUE the tween will smoothly snap all values to integers - + Tweens a Transform's X/Z localPosition to the given value, while also applying a jump effect along the Y axis. Returns a Sequence instead of a Tweener. Also stores the transform as the tween's target so it can be used for filtered operations The X/Z end value to reach, and the Y jump height + Power of the jump (the max height of the jump is represented by this plus the final Y offset) Total number of jumps The duration of the tween If TRUE the tween will smoothly snap all values to integers diff --git a/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween.dll b/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween.dll index 41a77ab..6ff8eab 100644 Binary files a/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween.dll and b/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween.dll differ diff --git a/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween.dll.mdb b/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween.dll.mdb index 68b7d65..68ddecb 100644 Binary files a/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween.dll.mdb and b/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween.dll.mdb differ diff --git a/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween43.dll b/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween43.dll index 96ca254..44bd8f8 100644 Binary files a/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween43.dll and b/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween43.dll differ diff --git a/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween43.dll.mdb b/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween43.dll.mdb index 55838b1..fdb82d3 100644 Binary files a/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween43.dll.mdb and b/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween43.dll.mdb differ diff --git a/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween43.xml b/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween43.xml index 25e4a2e..2264412 100644 --- a/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween43.xml +++ b/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween43.xml @@ -43,11 +43,12 @@ Also stores the Rigidbody2D as the tween's target so it can be used for filtered operations The end value to reachThe duration of the tween - + Tweens a Rigidbody2D's X position to the given value, while also applying a jump effect along the Y axis. Returns a Sequence instead of a Tweener. Also stores the Rigidbody2D as the tween's target so it can be used for filtered operations The X end value to reach, and the Y jump height + Power of the jump (the max height of the jump is represented by this plus the final Y offset) Total number of jumps The duration of the tween If TRUE the tween will smoothly snap all values to integers diff --git a/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween46.dll b/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween46.dll index efdccb9..8c91ebb 100644 Binary files a/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween46.dll and b/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween46.dll differ diff --git a/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween46.dll.mdb b/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween46.dll.mdb index 38b6995..df2b329 100644 Binary files a/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween46.dll.mdb and b/UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween46.dll.mdb differ diff --git a/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween.XML b/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween.XML index f73f235..b4cace0 100644 --- a/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween.XML +++ b/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween.XML @@ -757,7 +757,11 @@ Returns the elapsed percentage (0 to 1) of this tween (delays exluded) If TRUE returns the elapsed percentage since startup loops included, - otherwise the elapsed percentage within the current loop cycle + otherwise the elapsed percentage within the current loop cycle + + + Returns the elapsed percentage (0 to 1) of this tween (delays exluded), + based on a single loop, and calculating eventual backwards Yoyo loops as 1 to 0 instead of 0 to 1 Returns FALSE if this tween has been killed. @@ -1054,11 +1058,12 @@ Eventual axis constraint for the rotation The vector that defines in which direction up is (default: Vector3.up) - + Tweens a Rigidbody's X/Z position to the given value, while also applying a jump effect along the Y axis. Returns a Sequence instead of a Tweener. Also stores the Rigidbody as the tween's target so it can be used for filtered operations The X/Z end value to reach, and the Y jump height + Power of the jump (the max height of the jump is represented by this plus the final Y offset) Total number of jumps The duration of the tween If TRUE the tween will smoothly snap all values to integers @@ -1247,20 +1252,22 @@ Indicates how much the shake will be random (0 to 180 - values higher than 90 kind of suck, so beware). Setting it to 0 will shake along a single direction. - - Tweens a Transform's X/Z position to the given value, while also applying a jump effect along the Y axis. + + Tweens a Transform's position to the given value, while also applying a jump effect along the Y axis. Returns a Sequence instead of a Tweener. Also stores the transform as the tween's target so it can be used for filtered operations - The X/Z end value to reach, and the Y jump height + The end value to reach + Power of the jump (the max height of the jump is represented by this plus the final Y offset) Total number of jumps The duration of the tween If TRUE the tween will smoothly snap all values to integers - + Tweens a Transform's X/Z localPosition to the given value, while also applying a jump effect along the Y axis. Returns a Sequence instead of a Tweener. Also stores the transform as the tween's target so it can be used for filtered operations The X/Z end value to reach, and the Y jump height + Power of the jump (the max height of the jump is represented by this plus the final Y offset) Total number of jumps The duration of the tween If TRUE the tween will smoothly snap all values to integers diff --git a/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween.dll b/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween.dll index 41a77ab..6ff8eab 100644 Binary files a/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween.dll and b/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween.dll differ diff --git a/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween.dll.mdb b/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween.dll.mdb index 68b7d65..68ddecb 100644 Binary files a/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween.dll.mdb and b/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween.dll.mdb differ diff --git a/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween43.dll b/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween43.dll index 96ca254..44bd8f8 100644 Binary files a/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween43.dll and b/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween43.dll differ diff --git a/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween43.dll.mdb b/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween43.dll.mdb index 55838b1..fdb82d3 100644 Binary files a/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween43.dll.mdb and b/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween43.dll.mdb differ diff --git a/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween43.xml b/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween43.xml index 25e4a2e..2264412 100644 --- a/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween43.xml +++ b/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween43.xml @@ -43,11 +43,12 @@ Also stores the Rigidbody2D as the tween's target so it can be used for filtered operations The end value to reachThe duration of the tween - + Tweens a Rigidbody2D's X position to the given value, while also applying a jump effect along the Y axis. Returns a Sequence instead of a Tweener. Also stores the Rigidbody2D as the tween's target so it can be used for filtered operations The X end value to reach, and the Y jump height + Power of the jump (the max height of the jump is represented by this plus the final Y offset) Total number of jumps The duration of the tween If TRUE the tween will smoothly snap all values to integers diff --git a/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween46.dll b/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween46.dll index efdccb9..8c91ebb 100644 Binary files a/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween46.dll and b/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween46.dll differ diff --git a/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween46.dll.mdb b/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween46.dll.mdb index 38b6995..df2b329 100644 Binary files a/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween46.dll.mdb and b/UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween46.dll.mdb differ diff --git a/UnityTests.Unity5/Assets/_Tests PRO/TempPro.unity b/UnityTests.Unity5/Assets/_Tests PRO/TempPro.unity index 44a96be..1e23278 100644 Binary files a/UnityTests.Unity5/Assets/_Tests PRO/TempPro.unity and b/UnityTests.Unity5/Assets/_Tests PRO/TempPro.unity differ diff --git a/UnityTests.Unity5/Assets/_Tests/Jump.cs b/UnityTests.Unity5/Assets/_Tests/Jump.cs index 2a84146..f159c22 100644 --- a/UnityTests.Unity5/Assets/_Tests/Jump.cs +++ b/UnityTests.Unity5/Assets/_Tests/Jump.cs @@ -6,14 +6,16 @@ public class Jump : BrainBase { public Transform target; public Vector3 jump = new Vector3(4, 3, 0); + public float jumpHeight = 3; public int numJumps = 1; public float duration = 1; public Ease ease = Ease.OutQuad; + public int loops = -1; IEnumerator Start() { yield return new WaitForSeconds(1); - target.DOJump(jump, numJumps, duration).SetEase(ease).SetLoops(-1, LoopType.Yoyo); + target.DOJump(jump, jumpHeight, numJumps, duration).SetEase(ease).SetLoops(loops, LoopType.Yoyo); } } \ No newline at end of file diff --git a/UnityTests.Unity5/Assets/_Tests/Jump.unity b/UnityTests.Unity5/Assets/_Tests/Jump.unity index ba065d7..5f1dd1e 100644 Binary files a/UnityTests.Unity5/Assets/_Tests/Jump.unity and b/UnityTests.Unity5/Assets/_Tests/Jump.unity differ diff --git a/UnityTests.Unity5/Assets/_Tests/_Shared Sprites/Spaceship.png b/UnityTests.Unity5/Assets/_Tests/_Shared Sprites/Spaceship.png new file mode 100644 index 0000000..d7e7870 Binary files /dev/null and b/UnityTests.Unity5/Assets/_Tests/_Shared Sprites/Spaceship.png differ diff --git a/UnityTests.Unity5/Assets/_Tests/_Shared Sprites/Spaceship.png.meta b/UnityTests.Unity5/Assets/_Tests/_Shared Sprites/Spaceship.png.meta new file mode 100644 index 0000000..780b3ea --- /dev/null +++ b/UnityTests.Unity5/Assets/_Tests/_Shared Sprites/Spaceship.png.meta @@ -0,0 +1,55 @@ +fileFormatVersion: 2 +guid: 30b9eaf483abe564a95121a10370d87e +timeCreated: 1431943514 +licenseType: Free +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 8 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -3 + maxTextureSize: 256 + textureSettings: + filterMode: 1 + aniso: -1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 1 + textureType: 8 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/_DOTween.Assembly/DOTween/DOTween.cs b/_DOTween.Assembly/DOTween/DOTween.cs index 00d27ca..64c1b91 100644 --- a/_DOTween.Assembly/DOTween/DOTween.cs +++ b/_DOTween.Assembly/DOTween/DOTween.cs @@ -32,7 +32,7 @@ namespace DG.Tweening public class DOTween { /// DOTween's version - public static readonly string Version = "1.0.725"; + public static readonly string Version = "1.0.735"; /////////////////////////////////////////////// // Options //////////////////////////////////// diff --git a/_DOTween.Assembly/DOTween/ShortcutExtensions.cs b/_DOTween.Assembly/DOTween/ShortcutExtensions.cs index cfbed2d..e0506c9 100644 --- a/_DOTween.Assembly/DOTween/ShortcutExtensions.cs +++ b/_DOTween.Assembly/DOTween/ShortcutExtensions.cs @@ -432,36 +432,41 @@ namespace DG.Tweening /// Returns a Sequence instead of a Tweener. /// Also stores the Rigidbody as the tween's target so it can be used for filtered operations /// The X/Z end value to reach, and the Y jump height + /// Power of the jump (the max height of the jump is represented by this plus the final Y offset) /// Total number of jumps /// The duration of the tween /// If TRUE the tween will smoothly snap all values to integers - public static Sequence DOJump(this Rigidbody target, Vector3 endValue, int numJumps, float duration, bool snapping = false) + public static Sequence DOJump(this Rigidbody target, Vector3 endValue, float jumpPower, int numJumps, float duration, bool snapping = false) { if (numJumps < 1) numJumps = 1; - return DOTween.Sequence() + float offsetY = endValue.y - target.position.y; + Sequence s = DOTween.Sequence() #if COMPATIBLE .Append(DOTween.To(() => target.position, x => target.MovePosition(x.value), new Vector3(endValue.x, 0, 0), duration) #else .Append(DOTween.To(() => target.position, target.MovePosition, new Vector3(endValue.x, 0, 0), duration) #endif .SetOptions(AxisConstraint.X, snapping).SetEase(Ease.Linear) - ) #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 - .Join(DOTween.To(() => target.position, target.MovePosition, new Vector3(0, 0, endValue.z), duration) + ).Join(DOTween.To(() => target.position, target.MovePosition, new Vector3(0, 0, endValue.z), duration) #endif .SetOptions(AxisConstraint.Z, snapping).SetEase(Ease.Linear) - ) #if COMPATIBLE - .Join(DOTween.To(() => target.position, x => target.MovePosition(x.value), new Vector3(0, endValue.y, 0), duration / (numJumps * 2)) + ).Join(DOTween.To(() => target.position, x => target.MovePosition(x.value), new Vector3(0, jumpPower, 0), duration / (numJumps * 2)) #else - .Join(DOTween.To(() => target.position, target.MovePosition, new Vector3(0, endValue.y, 0), duration / (numJumps * 2)) + ).Join(DOTween.To(() => target.position, target.MovePosition, new Vector3(0, jumpPower, 0), duration / (numJumps * 2)) #endif .SetOptions(AxisConstraint.Y, snapping).SetEase(Ease.OutQuad) .SetLoops(numJumps * 2, LoopType.Yoyo) - ) - .SetTarget(target).SetEase(DOTween.defaultEaseType); + ).SetTarget(target).SetEase(DOTween.defaultEaseType); + s.OnUpdate(() => { + Vector3 pos = target.position; + pos.y += DOVirtual.EasedValue(0, offsetY, s.ElapsedDirectionalPercentage(), Ease.OutQuad); + target.MovePosition(pos); + }); + return s; } #endregion @@ -778,51 +783,61 @@ namespace DG.Tweening #region Special - /// Tweens a Transform's X/Z position to the given value, while also applying a jump effect along the Y axis. + /// Tweens a Transform's position to the given value, while also applying a jump effect along the Y axis. /// Returns a Sequence instead of a Tweener. /// Also stores the transform as the tween's target so it can be used for filtered operations - /// The X/Z end value to reach, and the Y jump height + /// The end value to reach + /// Power of the jump (the max height of the jump is represented by this plus the final Y offset) /// Total number of jumps /// The duration of the tween /// If TRUE the tween will smoothly snap all values to integers - public static Sequence DOJump(this Transform target, Vector3 endValue, int numJumps, float duration, bool snapping = false) + public static Sequence DOJump(this Transform target, Vector3 endValue, float jumpPower, int numJumps, float duration, bool snapping = false) { if (numJumps < 1) numJumps = 1; - return DOTween.Sequence() + float offsetY = endValue.y - target.position.y; + Sequence s = DOTween.Sequence() .Append(DOTween.To(() => target.position, x => target.position = x, new Vector3(endValue.x, 0, 0), duration) .SetOptions(AxisConstraint.X, snapping).SetEase(Ease.Linear) - ) - .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) - ) - .Join(DOTween.To(() => target.position, x => target.position = x, new Vector3(0, endValue.y, 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) .SetLoops(numJumps * 2, LoopType.Yoyo) - ) - .SetTarget(target).SetEase(DOTween.defaultEaseType); + ).SetTarget(target).SetEase(DOTween.defaultEaseType); + s.OnUpdate(() => { + Vector3 pos = target.position; + pos.y += DOVirtual.EasedValue(0, offsetY, s.ElapsedDirectionalPercentage(), Ease.OutQuad); + target.position = pos; + }); + return s; } /// Tweens a Transform's X/Z localPosition to the given value, while also applying a jump effect along the Y axis. /// Returns a Sequence instead of a Tweener. /// Also stores the transform as the tween's target so it can be used for filtered operations /// The X/Z end value to reach, and the Y jump height + /// Power of the jump (the max height of the jump is represented by this plus the final Y offset) /// Total number of jumps /// The duration of the tween /// If TRUE the tween will smoothly snap all values to integers - public static Sequence DOLocalJump(this Transform target, Vector3 endValue, int numJumps, float duration, bool snapping = false) + public static Sequence DOLocalJump(this Transform target, Vector3 endValue, float jumpPower, int numJumps, float duration, bool snapping = false) { if (numJumps < 1) numJumps = 1; - return DOTween.Sequence() + float offsetY = endValue.y - target.localPosition.y; + Sequence s = DOTween.Sequence() .Append(DOTween.To(() => target.localPosition, x => target.localPosition = x, new Vector3(endValue.x, 0, 0), duration) .SetOptions(AxisConstraint.X, snapping).SetEase(Ease.Linear) - ) - .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) - ) - .Join(DOTween.To(() => target.localPosition, x => target.localPosition = x, new Vector3(0, endValue.y, 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) .SetLoops(numJumps * 2, LoopType.Yoyo) - ) - .SetTarget(target).SetEase(DOTween.defaultEaseType); + ).SetTarget(target).SetEase(DOTween.defaultEaseType); + s.OnUpdate(() => { + Vector3 pos = target.localPosition; + pos.y += DOVirtual.EasedValue(0, offsetY, s.ElapsedDirectionalPercentage(), Ease.OutQuad); + target.localPosition = pos; + }); + return s; } /// Tweens a Transform's position through the given path waypoints, using the chosen path algorithm. diff --git a/_DOTween.Assembly/DOTween/TweenExtensions.cs b/_DOTween.Assembly/DOTween/TweenExtensions.cs index 6d73834..fed1ed9 100644 --- a/_DOTween.Assembly/DOTween/TweenExtensions.cs +++ b/_DOTween.Assembly/DOTween/TweenExtensions.cs @@ -407,7 +407,7 @@ namespace DG.Tweening } /// Returns the elapsed percentage (0 to 1) of this tween (delays exluded) /// If TRUE returns the elapsed percentage since startup loops included, - /// otherwise the elapsed percentage within the current loop cycle + /// otherwise the elapsed percentage within the current loop cycle public static float ElapsedPercentage(this Tween t, bool includeLoops = true) { if (!t.active) { @@ -421,6 +421,19 @@ namespace DG.Tweening } return t.position / t.duration; } + /// Returns the elapsed percentage (0 to 1) of this tween (delays exluded), + /// based on a single loop, and calculating eventual backwards Yoyo loops as 1 to 0 instead of 0 to 1 + public static float ElapsedDirectionalPercentage(this Tween t) + { + if (!t.active) { + if (Debugger.logPriority > 0) Debugger.LogInvalidTween(t); + return 0; + } + + float perc = t.position / t.duration; + bool isInverse = t.completedLoops > 0 && t.loopType == LoopType.Yoyo && t.completedLoops % 2 != 0; + return isInverse ? 1 - perc : perc; + } /// Returns FALSE if this tween has been killed. /// BEWARE: if this tween is recyclable it might have been spawned again for another use and thus return TRUE anyway. diff --git a/_DOTween.Assembly/DOTween43/ShortcutExtensions.cs b/_DOTween.Assembly/DOTween43/ShortcutExtensions.cs index 079272f..bc651e9 100644 --- a/_DOTween.Assembly/DOTween43/ShortcutExtensions.cs +++ b/_DOTween.Assembly/DOTween43/ShortcutExtensions.cs @@ -95,29 +95,35 @@ namespace DG.Tweening /// Returns a Sequence instead of a Tweener. /// Also stores the Rigidbody2D as the tween's target so it can be used for filtered operations /// The X end value to reach, and the Y jump height + /// Power of the jump (the max height of the jump is represented by this plus the final Y offset) /// Total number of jumps /// The duration of the tween /// If TRUE the tween will smoothly snap all values to integers - public static Sequence DOJump(this Rigidbody2D target, Vector2 endValue, int numJumps, float duration, bool snapping = false) + public static Sequence DOJump(this Rigidbody2D target, Vector2 endValue, float jumpPower, int numJumps, float duration, bool snapping = false) { if (numJumps < 1) numJumps = 1; - return DOTween.Sequence() + float offsetY = endValue.y - target.position.y; + Sequence s = DOTween.Sequence() #if COMPATIBLE - .Append(DOTween.To(() => target.position, x => target.MovePosition(x.value), new Vector2(endValue.x, 0), duration) + .Append(DOTween.To(() => target.position, x => target.MovePosition(x.value), new Vector3(endValue.x, 0, 0), duration) #else .Append(DOTween.To(() => target.position, target.MovePosition, new Vector2(endValue.x, 0), duration) #endif .SetOptions(AxisConstraint.X, snapping).SetEase(Ease.Linear) - ) #if COMPATIBLE - .Join(DOTween.To(() => target.position, x => target.MovePosition(x.value), new Vector2(0, endValue.y), duration / (numJumps * 2)) + ).Join(DOTween.To(() => target.position, x => target.MovePosition(x.value), new Vector3(0, jumpPower, 0), duration / (numJumps * 2)) #else - .Join(DOTween.To(() => target.position, target.MovePosition, new Vector2(0, endValue.y), duration / (numJumps * 2)) + ).Join(DOTween.To(() => target.position, target.MovePosition, new Vector2(0, jumpPower), duration / (numJumps * 2)) #endif .SetOptions(AxisConstraint.Y, snapping).SetEase(Ease.OutQuad) .SetLoops(numJumps * 2, LoopType.Yoyo) - ) - .SetTarget(target).SetEase(DOTween.defaultEaseType); + ).SetTarget(target).SetEase(DOTween.defaultEaseType); + s.OnUpdate(() => { + Vector2 pos = target.position; + pos.y += DOVirtual.EasedValue(0, offsetY, s.ElapsedDirectionalPercentage(), Ease.OutQuad); + target.MovePosition(pos); + }); + return s; } #endregion diff --git a/_DOTween.Assembly/bin/DOTween.XML b/_DOTween.Assembly/bin/DOTween.XML index f73f235..b4cace0 100644 --- a/_DOTween.Assembly/bin/DOTween.XML +++ b/_DOTween.Assembly/bin/DOTween.XML @@ -757,7 +757,11 @@ Returns the elapsed percentage (0 to 1) of this tween (delays exluded) If TRUE returns the elapsed percentage since startup loops included, - otherwise the elapsed percentage within the current loop cycle + otherwise the elapsed percentage within the current loop cycle + + + Returns the elapsed percentage (0 to 1) of this tween (delays exluded), + based on a single loop, and calculating eventual backwards Yoyo loops as 1 to 0 instead of 0 to 1 Returns FALSE if this tween has been killed. @@ -1054,11 +1058,12 @@ Eventual axis constraint for the rotation The vector that defines in which direction up is (default: Vector3.up) - + Tweens a Rigidbody's X/Z position to the given value, while also applying a jump effect along the Y axis. Returns a Sequence instead of a Tweener. Also stores the Rigidbody as the tween's target so it can be used for filtered operations The X/Z end value to reach, and the Y jump height + Power of the jump (the max height of the jump is represented by this plus the final Y offset) Total number of jumps The duration of the tween If TRUE the tween will smoothly snap all values to integers @@ -1247,20 +1252,22 @@ Indicates how much the shake will be random (0 to 180 - values higher than 90 kind of suck, so beware). Setting it to 0 will shake along a single direction. - - Tweens a Transform's X/Z position to the given value, while also applying a jump effect along the Y axis. + + Tweens a Transform's position to the given value, while also applying a jump effect along the Y axis. Returns a Sequence instead of a Tweener. Also stores the transform as the tween's target so it can be used for filtered operations - The X/Z end value to reach, and the Y jump height + The end value to reach + Power of the jump (the max height of the jump is represented by this plus the final Y offset) Total number of jumps The duration of the tween If TRUE the tween will smoothly snap all values to integers - + Tweens a Transform's X/Z localPosition to the given value, while also applying a jump effect along the Y axis. Returns a Sequence instead of a Tweener. Also stores the transform as the tween's target so it can be used for filtered operations The X/Z end value to reach, and the Y jump height + Power of the jump (the max height of the jump is represented by this plus the final Y offset) Total number of jumps The duration of the tween If TRUE the tween will smoothly snap all values to integers diff --git a/_DOTween.Assembly/bin/DOTween.dll b/_DOTween.Assembly/bin/DOTween.dll index 41a77ab..6ff8eab 100644 Binary files a/_DOTween.Assembly/bin/DOTween.dll and b/_DOTween.Assembly/bin/DOTween.dll differ diff --git a/_DOTween.Assembly/bin/DOTween.dll.mdb b/_DOTween.Assembly/bin/DOTween.dll.mdb index 68b7d65..68ddecb 100644 Binary files a/_DOTween.Assembly/bin/DOTween.dll.mdb and b/_DOTween.Assembly/bin/DOTween.dll.mdb differ diff --git a/_DOTween.Assembly/bin/DOTween43.dll b/_DOTween.Assembly/bin/DOTween43.dll index 96ca254..44bd8f8 100644 Binary files a/_DOTween.Assembly/bin/DOTween43.dll and b/_DOTween.Assembly/bin/DOTween43.dll differ diff --git a/_DOTween.Assembly/bin/DOTween43.dll.mdb b/_DOTween.Assembly/bin/DOTween43.dll.mdb index 55838b1..fdb82d3 100644 Binary files a/_DOTween.Assembly/bin/DOTween43.dll.mdb and b/_DOTween.Assembly/bin/DOTween43.dll.mdb differ diff --git a/_DOTween.Assembly/bin/DOTween43.xml b/_DOTween.Assembly/bin/DOTween43.xml index 25e4a2e..2264412 100644 --- a/_DOTween.Assembly/bin/DOTween43.xml +++ b/_DOTween.Assembly/bin/DOTween43.xml @@ -43,11 +43,12 @@ Also stores the Rigidbody2D as the tween's target so it can be used for filtered operations The end value to reachThe duration of the tween - + Tweens a Rigidbody2D's X position to the given value, while also applying a jump effect along the Y axis. Returns a Sequence instead of a Tweener. Also stores the Rigidbody2D as the tween's target so it can be used for filtered operations The X end value to reach, and the Y jump height + Power of the jump (the max height of the jump is represented by this plus the final Y offset) Total number of jumps The duration of the tween If TRUE the tween will smoothly snap all values to integers diff --git a/_DOTween.Assembly/bin/DOTween46.dll b/_DOTween.Assembly/bin/DOTween46.dll index efdccb9..8c91ebb 100644 Binary files a/_DOTween.Assembly/bin/DOTween46.dll and b/_DOTween.Assembly/bin/DOTween46.dll differ diff --git a/_DOTween.Assembly/bin/DOTween46.dll.mdb b/_DOTween.Assembly/bin/DOTween46.dll.mdb index 38b6995..df2b329 100644 Binary files a/_DOTween.Assembly/bin/DOTween46.dll.mdb and b/_DOTween.Assembly/bin/DOTween46.dll.mdb differ