1
0
mirror of https://github.com/Cardidi/dotween-upm-fork.git synced 2025-12-20 09:16:02 +08:00

Fixed path orientation issue when rewinding

This commit is contained in:
Daniele Giardini 2015-05-27 13:01:57 +02:00
parent 934091a63e
commit b56c49e441
75 changed files with 163 additions and 34 deletions

View File

@ -2187,5 +2187,21 @@
Public only so custom shortcuts can access some of these methods Public only so custom shortcuts can access some of these methods
</summary> </summary>
</member> </member>
<member name="T:DG.Tweening.Core.Enums.UpdateNotice">
<summary>
Additional notices passed to plugins when updating.
Public so it can be used by custom plugins. Internally, only PathPlugin uses it
</summary>
</member>
<member name="F:DG.Tweening.Core.Enums.UpdateNotice.None">
<summary>
None
</summary>
</member>
<member name="F:DG.Tweening.Core.Enums.UpdateNotice.RewindStep">
<summary>
Lets the plugin know that we restarted or rewinded
</summary>
</member>
</members> </members>
</doc> </doc>

View File

@ -2187,5 +2187,21 @@
Public only so custom shortcuts can access some of these methods Public only so custom shortcuts can access some of these methods
</summary> </summary>
</member> </member>
<member name="T:DG.Tweening.Core.Enums.UpdateNotice">
<summary>
Additional notices passed to plugins when updating.
Public so it can be used by custom plugins. Internally, only PathPlugin uses it
</summary>
</member>
<member name="F:DG.Tweening.Core.Enums.UpdateNotice.None">
<summary>
None
</summary>
</member>
<member name="F:DG.Tweening.Core.Enums.UpdateNotice.RewindStep">
<summary>
Lets the plugin know that we restarted or rewinded
</summary>
</member>
</members> </members>
</doc> </doc>

View File

@ -2187,5 +2187,21 @@
Public only so custom shortcuts can access some of these methods Public only so custom shortcuts can access some of these methods
</summary> </summary>
</member> </member>
<member name="T:DG.Tweening.Core.Enums.UpdateNotice">
<summary>
Additional notices passed to plugins when updating.
Public so it can be used by custom plugins. Internally, only PathPlugin uses it
</summary>
</member>
<member name="F:DG.Tweening.Core.Enums.UpdateNotice.None">
<summary>
None
</summary>
</member>
<member name="F:DG.Tweening.Core.Enums.UpdateNotice.RewindStep">
<summary>
Lets the plugin know that we restarted or rewinded
</summary>
</member>
</members> </members>
</doc> </doc>

View File

@ -1,6 +1,7 @@
using DG.Tweening; using DG.Tweening;
using DG.Tweening.Core; using DG.Tweening.Core;
using DG.Tweening.Core.Easing; using DG.Tweening.Core.Easing;
using DG.Tweening.Core.Enums;
using DG.Tweening.Plugins.Core; using DG.Tweening.Plugins.Core;
using DG.Tweening.Plugins.Options; using DG.Tweening.Plugins.Options;
using System; using System;
@ -63,7 +64,7 @@ public class CustomPlugin : ABSTweenPlugin<Vector3,Vector3,NoOptions>
return res; return res;
} }
public override void EvaluateAndApply(NoOptions options, Tween t, bool isRelative, DOGetter<Vector3> getter, DOSetter<Vector3> setter, float elapsed, Vector3 startValue, Vector3 changeValue, float duration, bool usingInversePosition) public override void EvaluateAndApply(NoOptions options, Tween t, bool isRelative, DOGetter<Vector3> getter, DOSetter<Vector3> setter, float elapsed, Vector3 startValue, Vector3 changeValue, float duration, bool usingInversePosition, UpdateNotice updateNotice)
{ {
Vector3 res = getter(); Vector3 res = getter();
float easeVal = EaseManager.Evaluate(t, elapsed, duration, t.easeOvershootOrAmplitude, t.easePeriod); float easeVal = EaseManager.Evaluate(t, elapsed, duration, t.easeOvershootOrAmplitude, t.easePeriod);

View File

@ -6,6 +6,7 @@ using System.Collections;
public class Follow : BrainBase public class Follow : BrainBase
{ {
public Transform target, follow; public Transform target, follow;
public float someInt;
void Start() void Start()
{ {
@ -14,7 +15,15 @@ public class Follow : BrainBase
tween.OnUpdate(() => tween.OnUpdate(() =>
{ {
tween.ChangeEndValue(follow.position, true); // someInt = 0;
// someInt = follow.position.x + tween.ElapsedPercentage();
// tween.ChangeEndValue(follow.position, true);
SomeFunction<Vector3>(follow.position);
}); });
} }
void SomeFunction<T>(T obj)
{
someInt = 1;
}
} }

View File

@ -0,0 +1,21 @@
// Author: Daniele Giardini - http://www.demigiant.com
// Created: 2015/05/27 12:23
namespace DG.Tweening.Core.Enums
{
/// <summary>
/// Additional notices passed to plugins when updating.
/// Public so it can be used by custom plugins. Internally, only PathPlugin uses it
/// </summary>
public enum UpdateNotice
{
/// <summary>
/// None
/// </summary>
None,
/// <summary>
/// Lets the plugin know that we restarted or rewinded
/// </summary>
RewindStep
}
}

View File

@ -167,18 +167,18 @@ namespace DG.Tweening.Core
// Applies the tween set by DoGoto. // Applies the tween set by DoGoto.
// Returns TRUE if the tween needs to be killed // Returns TRUE if the tween needs to be killed
internal override bool ApplyTween(float prevPosition, int prevCompletedLoops, int newCompletedSteps, bool useInversePosition, UpdateMode updateMode) internal override bool ApplyTween(float prevPosition, int prevCompletedLoops, int newCompletedSteps, bool useInversePosition, UpdateMode updateMode, UpdateNotice updateNotice)
{ {
float updatePosition = useInversePosition ? duration - position : position; float updatePosition = useInversePosition ? duration - position : position;
if (DOTween.useSafeMode) { if (DOTween.useSafeMode) {
try { try {
tweenPlugin.EvaluateAndApply(plugOptions, this, isRelative, getter, setter, updatePosition, startValue, changeValue, duration, useInversePosition); tweenPlugin.EvaluateAndApply(plugOptions, this, isRelative, getter, setter, updatePosition, startValue, changeValue, duration, useInversePosition, updateNotice);
} catch { } catch {
// Target/field doesn't exist anymore: kill tween // Target/field doesn't exist anymore: kill tween
return true; return true;
} }
} else { } else {
tweenPlugin.EvaluateAndApply(plugOptions, this, isRelative, getter, setter, updatePosition, startValue, changeValue, duration, useInversePosition); tweenPlugin.EvaluateAndApply(plugOptions, this, isRelative, getter, setter, updatePosition, startValue, changeValue, duration, useInversePosition, updateNotice);
} }
return false; return false;
} }

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.0.745"; public static readonly string Version = "1.0.750";
/////////////////////////////////////////////// ///////////////////////////////////////////////
// Options //////////////////////////////////// // Options ////////////////////////////////////

View File

@ -68,6 +68,7 @@
<Compile Include="Core\Enums\FilterType.cs" /> <Compile Include="Core\Enums\FilterType.cs" />
<Compile Include="Core\Enums\OperationType.cs" /> <Compile Include="Core\Enums\OperationType.cs" />
<Compile Include="Core\Enums\SpecialStartupMode.cs" /> <Compile Include="Core\Enums\SpecialStartupMode.cs" />
<Compile Include="Core\Enums\UpdateNotice.cs" />
<Compile Include="Core\Enums\UpdateMode.cs" /> <Compile Include="Core\Enums\UpdateMode.cs" />
<Compile Include="Core\Extensions.cs" /> <Compile Include="Core\Extensions.cs" />
<Compile Include="Core\SequenceCallback.cs" /> <Compile Include="Core\SequenceCallback.cs" />

View File

@ -4,6 +4,7 @@
using System; using System;
using DG.Tweening.Core; using DG.Tweening.Core;
using DG.Tweening.Core.Easing; using DG.Tweening.Core.Easing;
using DG.Tweening.Core.Enums;
using DG.Tweening.Plugins.Core; using DG.Tweening.Plugins.Core;
using DG.Tweening.Plugins.Options; using DG.Tweening.Plugins.Options;
using UnityEngine; using UnityEngine;
@ -49,7 +50,7 @@ namespace DG.Tweening.Plugins
return 1f / unitsXSecond; return 1f / unitsXSecond;
} }
public override void EvaluateAndApply(ColorOptions options, Tween t, bool isRelative, DOGetter<Color2> getter, DOSetter<Color2> setter, float elapsed, Color2 startValue, Color2 changeValue, float duration, bool usingInversePosition) public override void EvaluateAndApply(ColorOptions options, Tween t, bool isRelative, DOGetter<Color2> getter, DOSetter<Color2> setter, float elapsed, Color2 startValue, Color2 changeValue, float duration, bool usingInversePosition, UpdateNotice updateNotice)
{ {
if (t.loopType == LoopType.Incremental) startValue += changeValue * (t.isComplete ? t.completedLoops - 1 : t.completedLoops); if (t.loopType == LoopType.Incremental) startValue += changeValue * (t.isComplete ? t.completedLoops - 1 : t.completedLoops);
if (t.isSequenced && t.sequenceParent.loopType == LoopType.Incremental) { if (t.isSequenced && t.sequenceParent.loopType == LoopType.Incremental) {

View File

@ -7,6 +7,7 @@
using DG.Tweening.Core; using DG.Tweening.Core;
using DG.Tweening.Core.Easing; using DG.Tweening.Core.Easing;
using DG.Tweening.Core.Enums;
using DG.Tweening.Plugins.Core; using DG.Tweening.Plugins.Core;
using DG.Tweening.Plugins.Options; using DG.Tweening.Plugins.Options;
using UnityEngine; using UnityEngine;
@ -49,7 +50,7 @@ namespace DG.Tweening.Plugins
return 1f / unitsXSecond; return 1f / unitsXSecond;
} }
public override void EvaluateAndApply(ColorOptions options, Tween t, bool isRelative, DOGetter<Color> getter, DOSetter<Color> setter, float elapsed, Color startValue, Color changeValue, float duration, bool usingInversePosition) public override void EvaluateAndApply(ColorOptions options, Tween t, bool isRelative, DOGetter<Color> getter, DOSetter<Color> setter, float elapsed, Color startValue, Color changeValue, float duration, bool usingInversePosition, UpdateNotice updateNotice)
{ {
if (t.loopType == LoopType.Incremental) startValue += changeValue * (t.isComplete ? t.completedLoops - 1 : t.completedLoops); if (t.loopType == LoopType.Incremental) startValue += changeValue * (t.isComplete ? t.completedLoops - 1 : t.completedLoops);
if (t.isSequenced && t.sequenceParent.loopType == LoopType.Incremental) { if (t.isSequenced && t.sequenceParent.loopType == LoopType.Incremental) {

View File

@ -4,6 +4,7 @@
using DG.Tweening.Core; using DG.Tweening.Core;
using DG.Tweening.Core.Easing; using DG.Tweening.Core.Easing;
using DG.Tweening.Core.Enums;
using DG.Tweening.Core.Surrogates; using DG.Tweening.Core.Surrogates;
using DG.Tweening.Plugins.Core; using DG.Tweening.Plugins.Core;
using DG.Tweening.Plugins.Options; using DG.Tweening.Plugins.Options;
@ -47,7 +48,7 @@ namespace DG.Tweening.Plugins
return 1f / unitsXSecond; return 1f / unitsXSecond;
} }
public override void EvaluateAndApply(ColorOptions options, Tween t, bool isRelative, DOGetter<ColorWrapper> getter, DOSetter<ColorWrapper> setter, float elapsed, ColorWrapper startValue, ColorWrapper changeValue, float duration, bool usingInversePosition) public override void EvaluateAndApply(ColorOptions options, Tween t, bool isRelative, DOGetter<ColorWrapper> getter, DOSetter<ColorWrapper> setter, float elapsed, ColorWrapper startValue, ColorWrapper changeValue, float duration, bool usingInversePosition, UpdateNotice updateNotice)
{ {
if (t.loopType == LoopType.Incremental) startValue.value += changeValue.value * (t.isComplete ? t.completedLoops - 1 : t.completedLoops); if (t.loopType == LoopType.Incremental) startValue.value += changeValue.value * (t.isComplete ? t.completedLoops - 1 : t.completedLoops);
if (t.isSequenced && t.sequenceParent.loopType == LoopType.Incremental) { if (t.isSequenced && t.sequenceParent.loopType == LoopType.Incremental) {

View File

@ -5,6 +5,7 @@
// This work is subject to the terms at http://dotween.demigiant.com/license.php // This work is subject to the terms at http://dotween.demigiant.com/license.php
using DG.Tweening.Core; using DG.Tweening.Core;
using DG.Tweening.Core.Enums;
#pragma warning disable 1591 #pragma warning disable 1591
namespace DG.Tweening.Plugins.Core namespace DG.Tweening.Plugins.Core
@ -19,6 +20,6 @@ namespace DG.Tweening.Plugins.Core
public abstract void SetChangeValue(TweenerCore<T1, T2, TPlugOptions> t); public abstract void SetChangeValue(TweenerCore<T1, T2, TPlugOptions> t);
public abstract float GetSpeedBasedDuration(TPlugOptions options, float unitsXSecond, T2 changeValue); public abstract float GetSpeedBasedDuration(TPlugOptions options, float unitsXSecond, T2 changeValue);
// usingInversePosition is used by PathPlugin to calculate correctly the current waypoint reached // usingInversePosition is used by PathPlugin to calculate correctly the current waypoint reached
public abstract void EvaluateAndApply(TPlugOptions options, Tween t, bool isRelative, DOGetter<T1> getter, DOSetter<T1> setter, float elapsed, T2 startValue, T2 changeValue, float duration, bool usingInversePosition); public abstract void EvaluateAndApply(TPlugOptions options, Tween t, bool isRelative, DOGetter<T1> getter, DOSetter<T1> setter, float elapsed, T2 startValue, T2 changeValue, float duration, bool usingInversePosition, UpdateNotice updateNotice);
} }
} }

View File

@ -7,6 +7,7 @@
using System; using System;
using DG.Tweening.Core; using DG.Tweening.Core;
using DG.Tweening.Core.Easing; using DG.Tweening.Core.Easing;
using DG.Tweening.Core.Enums;
using DG.Tweening.Plugins.Core; using DG.Tweening.Plugins.Core;
using DG.Tweening.Plugins.Options; using DG.Tweening.Plugins.Options;
using UnityEngine; using UnityEngine;
@ -48,7 +49,7 @@ namespace DG.Tweening.Plugins
return res; return res;
} }
public override void EvaluateAndApply(FloatOptions options, Tween t, bool isRelative, DOGetter<float> getter, DOSetter<float> setter, float elapsed, float startValue, float changeValue, float duration, bool usingInversePosition) public override void EvaluateAndApply(FloatOptions options, Tween t, bool isRelative, DOGetter<float> getter, DOSetter<float> setter, float elapsed, float startValue, float changeValue, float duration, bool usingInversePosition, UpdateNotice updateNotice)
{ {
if (t.loopType == LoopType.Incremental) startValue += changeValue * (t.isComplete ? t.completedLoops - 1 : t.completedLoops); if (t.loopType == LoopType.Incremental) startValue += changeValue * (t.isComplete ? t.completedLoops - 1 : t.completedLoops);
if (t.isSequenced && t.sequenceParent.loopType == LoopType.Incremental) { if (t.isSequenced && t.sequenceParent.loopType == LoopType.Incremental) {

View File

@ -7,6 +7,7 @@
using System; using System;
using DG.Tweening.Core; using DG.Tweening.Core;
using DG.Tweening.Core.Easing; using DG.Tweening.Core.Easing;
using DG.Tweening.Core.Enums;
using DG.Tweening.Plugins.Core; using DG.Tweening.Plugins.Core;
using DG.Tweening.Plugins.Options; using DG.Tweening.Plugins.Options;
@ -47,7 +48,7 @@ namespace DG.Tweening.Plugins
return res; return res;
} }
public override void EvaluateAndApply(NoOptions options, Tween t, bool isRelative, DOGetter<int> getter, DOSetter<int> setter, float elapsed, int startValue, int changeValue, float duration, bool usingInversePosition) public override void EvaluateAndApply(NoOptions options, Tween t, bool isRelative, DOGetter<int> getter, DOSetter<int> setter, float elapsed, int startValue, int changeValue, float duration, bool usingInversePosition, UpdateNotice updateNotice)
{ {
if (t.loopType == LoopType.Incremental) startValue += changeValue * (t.isComplete ? t.completedLoops - 1 : t.completedLoops); if (t.loopType == LoopType.Incremental) startValue += changeValue * (t.isComplete ? t.completedLoops - 1 : t.completedLoops);
if (t.isSequenced && t.sequenceParent.loopType == LoopType.Incremental) { if (t.isSequenced && t.sequenceParent.loopType == LoopType.Incremental) {

View File

@ -4,6 +4,7 @@
using System; using System;
using DG.Tweening.Core; using DG.Tweening.Core;
using DG.Tweening.Core.Easing; using DG.Tweening.Core.Easing;
using DG.Tweening.Core.Enums;
using DG.Tweening.Plugins.Core; using DG.Tweening.Plugins.Core;
using DG.Tweening.Plugins.Options; using DG.Tweening.Plugins.Options;
@ -44,7 +45,7 @@ namespace DG.Tweening.Plugins
return res; return res;
} }
public override void EvaluateAndApply(NoOptions options, Tween t, bool isRelative, DOGetter<long> getter, DOSetter<long> setter, float elapsed, long startValue, long changeValue, float duration, bool usingInversePosition) public override void EvaluateAndApply(NoOptions options, Tween t, bool isRelative, DOGetter<long> getter, DOSetter<long> setter, float elapsed, long startValue, long changeValue, float duration, bool usingInversePosition, UpdateNotice updateNotice)
{ {
if (t.loopType == LoopType.Incremental) startValue += changeValue * (t.isComplete ? t.completedLoops - 1 : t.completedLoops); if (t.loopType == LoopType.Incremental) startValue += changeValue * (t.isComplete ? t.completedLoops - 1 : t.completedLoops);
if (t.isSequenced && t.sequenceParent.loopType == LoopType.Incremental) { if (t.isSequenced && t.sequenceParent.loopType == LoopType.Incremental) {

View File

@ -31,6 +31,7 @@ namespace DG.Tweening.Plugins.Options
public bool useLocalPosition; public bool useLocalPosition;
public Transform parent; // Only used with OrientType.ToPath and useLocalPosition set as TRUE public Transform parent; // Only used with OrientType.ToPath and useLocalPosition set as TRUE
internal Quaternion startupRot; // Used to reset orientation when rewinding
internal float startupZRot; // Used to store Z value in case of lock Z, in order to rotate things differently internal float startupZRot; // Used to store Z value in case of lock Z, in order to rotate things differently
} }
} }

View File

@ -6,6 +6,7 @@
using DG.Tweening.Core; using DG.Tweening.Core;
using DG.Tweening.Core.Easing; using DG.Tweening.Core.Easing;
using DG.Tweening.Core.Enums;
using DG.Tweening.Plugins.Core; using DG.Tweening.Plugins.Core;
using DG.Tweening.Plugins.Core.PathCore; using DG.Tweening.Plugins.Core.PathCore;
using DG.Tweening.Plugins.Options; using DG.Tweening.Plugins.Options;
@ -87,6 +88,7 @@ namespace DG.Tweening.Plugins
// Finalize path // Finalize path
path.FinalizePath(t.plugOptions.isClosedPath, t.plugOptions.lockPositionAxis, currVal); path.FinalizePath(t.plugOptions.isClosedPath, t.plugOptions.lockPositionAxis, currVal);
t.plugOptions.startupRot = trans.rotation;
t.plugOptions.startupZRot = trans.eulerAngles.z; t.plugOptions.startupZRot = trans.eulerAngles.z;
// Set changeValue as a reference to endValue // Set changeValue as a reference to endValue
@ -98,7 +100,7 @@ namespace DG.Tweening.Plugins
return changeValue.length / unitsXSecond; return changeValue.length / unitsXSecond;
} }
public override void EvaluateAndApply(PathOptions options, Tween t, bool isRelative, DOGetter<Vector3> getter, DOSetter<Vector3> setter, float elapsed, Path startValue, Path changeValue, float duration, bool usingInversePosition) public override void EvaluateAndApply(PathOptions options, Tween t, bool isRelative, DOGetter<Vector3> getter, DOSetter<Vector3> setter, float elapsed, Path startValue, Path changeValue, float duration, bool usingInversePosition, UpdateNotice updateNotice)
{ {
float pathPerc = EaseManager.Evaluate(t.easeType, t.customEase, elapsed, duration, t.easeOvershootOrAmplitude, t.easePeriod); float pathPerc = EaseManager.Evaluate(t.easeType, t.customEase, elapsed, duration, t.easeOvershootOrAmplitude, t.easePeriod);
float constantPathPerc = changeValue.ConvertToConstantPathPerc(pathPerc); float constantPathPerc = changeValue.ConvertToConstantPathPerc(pathPerc);
@ -106,7 +108,7 @@ namespace DG.Tweening.Plugins
changeValue.targetPosition = newPos; // Used to draw editor gizmos changeValue.targetPosition = newPos; // Used to draw editor gizmos
setter(newPos); setter(newPos);
if (options.mode != PathMode.Ignore && options.orientType != OrientType.None) SetOrientation(options, t, changeValue, constantPathPerc, newPos); if (options.mode != PathMode.Ignore && options.orientType != OrientType.None) SetOrientation(options, t, changeValue, constantPathPerc, newPos, updateNotice);
// Determine if current waypoint changed and eventually dispatch callback // Determine if current waypoint changed and eventually dispatch callback
bool isForward = !usingInversePosition; bool isForward = !usingInversePosition;
@ -119,11 +121,16 @@ namespace DG.Tweening.Plugins
} }
// Public so it can be called by GotoWaypoint // Public so it can be called by GotoWaypoint
public void SetOrientation(PathOptions options, Tween t, Path path, float pathPerc, Vector3 tPos) public void SetOrientation(PathOptions options, Tween t, Path path, float pathPerc, Vector3 tPos, UpdateNotice updateNotice)
{ {
Transform trans = (Transform)t.target; Transform trans = (Transform)t.target;
Quaternion newRot = Quaternion.identity; Quaternion newRot = Quaternion.identity;
if (updateNotice == UpdateNotice.RewindStep) {
// Reset orientation before continuing
trans.rotation = options.startupRot;
}
switch (options.orientType) { switch (options.orientType) {
case OrientType.LookAtPosition: case OrientType.LookAtPosition:
path.lookAtPosition = options.lookAtPosition; // Used to draw editor gizmos path.lookAtPosition = options.lookAtPosition; // Used to draw editor gizmos

View File

@ -7,6 +7,7 @@
using DG.Tweening.Core; using DG.Tweening.Core;
using DG.Tweening.Core.Easing; using DG.Tweening.Core.Easing;
using DG.Tweening.Core.Enums;
using DG.Tweening.Plugins.Core; using DG.Tweening.Plugins.Core;
using DG.Tweening.Plugins.Options; using DG.Tweening.Plugins.Options;
using UnityEngine; using UnityEngine;
@ -79,7 +80,7 @@ namespace DG.Tweening.Plugins
return changeValue.magnitude / unitsXSecond; return changeValue.magnitude / unitsXSecond;
} }
public override void EvaluateAndApply(QuaternionOptions options, Tween t, bool isRelative, DOGetter<Quaternion> getter, DOSetter<Quaternion> setter, float elapsed, Vector3 startValue, Vector3 changeValue, float duration, bool usingInversePosition) public override void EvaluateAndApply(QuaternionOptions options, Tween t, bool isRelative, DOGetter<Quaternion> getter, DOSetter<Quaternion> setter, float elapsed, Vector3 startValue, Vector3 changeValue, float duration, bool usingInversePosition, UpdateNotice updateNotice)
{ {
Vector3 endValue = startValue; Vector3 endValue = startValue;

View File

@ -4,6 +4,7 @@
using DG.Tweening.Core; using DG.Tweening.Core;
using DG.Tweening.Core.Easing; using DG.Tweening.Core.Easing;
using DG.Tweening.Core.Enums;
using DG.Tweening.Core.Surrogates; using DG.Tweening.Core.Surrogates;
using DG.Tweening.Plugins.Core; using DG.Tweening.Plugins.Core;
using DG.Tweening.Plugins.Options; using DG.Tweening.Plugins.Options;
@ -77,7 +78,7 @@ namespace DG.Tweening.Plugins
return changeValue.value.magnitude / unitsXSecond; return changeValue.value.magnitude / unitsXSecond;
} }
public override void EvaluateAndApply(QuaternionOptions options, Tween t, bool isRelative, DOGetter<QuaternionWrapper> getter, DOSetter<QuaternionWrapper> setter, float elapsed, Vector3Wrapper startValue, Vector3Wrapper changeValue, float duration, bool usingInversePosition) public override void EvaluateAndApply(QuaternionOptions options, Tween t, bool isRelative, DOGetter<QuaternionWrapper> getter, DOSetter<QuaternionWrapper> setter, float elapsed, Vector3Wrapper startValue, Vector3Wrapper changeValue, float duration, bool usingInversePosition, UpdateNotice updateNotice)
{ {
Vector3 endValue = startValue.value; Vector3 endValue = startValue.value;

View File

@ -7,6 +7,7 @@
using System; using System;
using DG.Tweening.Core; using DG.Tweening.Core;
using DG.Tweening.Core.Easing; using DG.Tweening.Core.Easing;
using DG.Tweening.Core.Enums;
using DG.Tweening.Plugins.Core; using DG.Tweening.Plugins.Core;
using DG.Tweening.Plugins.Options; using DG.Tweening.Plugins.Options;
using UnityEngine; using UnityEngine;
@ -73,7 +74,7 @@ namespace DG.Tweening.Plugins
return diag / unitsXSecond; return diag / unitsXSecond;
} }
public override void EvaluateAndApply(NoOptions options, Tween t, bool isRelative, DOGetter<RectOffset> getter, DOSetter<RectOffset> setter, float elapsed, RectOffset startValue, RectOffset changeValue, float duration, bool usingInversePosition) public override void EvaluateAndApply(NoOptions options, Tween t, bool isRelative, DOGetter<RectOffset> getter, DOSetter<RectOffset> setter, float elapsed, RectOffset startValue, RectOffset changeValue, float duration, bool usingInversePosition, UpdateNotice updateNotice)
{ {
_r.left = startValue.left; _r.left = startValue.left;
_r.right = startValue.right; _r.right = startValue.right;

View File

@ -7,6 +7,7 @@
using System; using System;
using DG.Tweening.Core; using DG.Tweening.Core;
using DG.Tweening.Core.Easing; using DG.Tweening.Core.Easing;
using DG.Tweening.Core.Enums;
using DG.Tweening.Plugins.Core; using DG.Tweening.Plugins.Core;
using DG.Tweening.Plugins.Options; using DG.Tweening.Plugins.Options;
using UnityEngine; using UnityEngine;
@ -71,7 +72,7 @@ namespace DG.Tweening.Plugins
return diag / unitsXSecond; return diag / unitsXSecond;
} }
public override void EvaluateAndApply(RectOptions options, Tween t, bool isRelative, DOGetter<Rect> getter, DOSetter<Rect> setter, float elapsed, Rect startValue, Rect changeValue, float duration, bool usingInversePosition) public override void EvaluateAndApply(RectOptions options, Tween t, bool isRelative, DOGetter<Rect> getter, DOSetter<Rect> setter, float elapsed, Rect startValue, Rect changeValue, float duration, bool usingInversePosition, UpdateNotice updateNotice)
{ {
if (t.loopType == LoopType.Incremental) { if (t.loopType == LoopType.Incremental) {
int iterations = t.isComplete ? t.completedLoops - 1 : t.completedLoops; int iterations = t.isComplete ? t.completedLoops - 1 : t.completedLoops;

View File

@ -10,6 +10,7 @@ using System.Text;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using DG.Tweening.Core; using DG.Tweening.Core;
using DG.Tweening.Core.Easing; using DG.Tweening.Core.Easing;
using DG.Tweening.Core.Enums;
using DG.Tweening.Plugins.Core; using DG.Tweening.Plugins.Core;
using DG.Tweening.Plugins.Options; using DG.Tweening.Plugins.Options;
using UnityEngine; using UnityEngine;
@ -64,7 +65,7 @@ namespace DG.Tweening.Plugins
} }
// ChangeValue is the same as endValue in this plugin // ChangeValue is the same as endValue in this plugin
public override void EvaluateAndApply(StringOptions options, Tween t, bool isRelative, DOGetter<string> getter, DOSetter<string> setter, float elapsed, string startValue, string changeValue, float duration, bool usingInversePosition) public override void EvaluateAndApply(StringOptions options, Tween t, bool isRelative, DOGetter<string> getter, DOSetter<string> setter, float elapsed, string startValue, string changeValue, float duration, bool usingInversePosition, UpdateNotice updateNotice)
{ {
_Buffer.Remove(0, _Buffer.Length); _Buffer.Remove(0, _Buffer.Length);

View File

@ -7,6 +7,7 @@
using System; using System;
using DG.Tweening.Core; using DG.Tweening.Core;
using DG.Tweening.Core.Easing; using DG.Tweening.Core.Easing;
using DG.Tweening.Core.Enums;
using DG.Tweening.Plugins.Core; using DG.Tweening.Plugins.Core;
using DG.Tweening.Plugins.Options; using DG.Tweening.Plugins.Options;
@ -47,7 +48,7 @@ namespace DG.Tweening.Plugins
return res; return res;
} }
public override void EvaluateAndApply(NoOptions options, Tween t, bool isRelative, DOGetter<uint> getter, DOSetter<uint> setter, float elapsed, uint startValue, uint changeValue, float duration, bool usingInversePosition) public override void EvaluateAndApply(NoOptions options, Tween t, bool isRelative, DOGetter<uint> getter, DOSetter<uint> setter, float elapsed, uint startValue, uint changeValue, float duration, bool usingInversePosition, UpdateNotice updateNotice)
{ {
if (t.loopType == LoopType.Incremental) startValue += (uint)(changeValue * (t.isComplete ? t.completedLoops - 1 : t.completedLoops)); if (t.loopType == LoopType.Incremental) startValue += (uint)(changeValue * (t.isComplete ? t.completedLoops - 1 : t.completedLoops));
if (t.isSequenced && t.sequenceParent.loopType == LoopType.Incremental) { if (t.isSequenced && t.sequenceParent.loopType == LoopType.Incremental) {

View File

@ -4,6 +4,7 @@
using System; using System;
using DG.Tweening.Core; using DG.Tweening.Core;
using DG.Tweening.Core.Easing; using DG.Tweening.Core.Easing;
using DG.Tweening.Core.Enums;
using DG.Tweening.Plugins.Core; using DG.Tweening.Plugins.Core;
using DG.Tweening.Plugins.Options; using DG.Tweening.Plugins.Options;
using UnityEngine; using UnityEngine;
@ -45,7 +46,7 @@ namespace DG.Tweening.Plugins
return res; return res;
} }
public override void EvaluateAndApply(NoOptions options, Tween t, bool isRelative, DOGetter<ulong> getter, DOSetter<ulong> setter, float elapsed, ulong startValue, ulong changeValue, float duration, bool usingInversePosition) public override void EvaluateAndApply(NoOptions options, Tween t, bool isRelative, DOGetter<ulong> getter, DOSetter<ulong> setter, float elapsed, ulong startValue, ulong changeValue, float duration, bool usingInversePosition, UpdateNotice updateNotice)
{ {
if (t.loopType == LoopType.Incremental) startValue += changeValue * (uint)(t.isComplete ? t.completedLoops - 1 : t.completedLoops); if (t.loopType == LoopType.Incremental) startValue += changeValue * (uint)(t.isComplete ? t.completedLoops - 1 : t.completedLoops);
if (t.isSequenced && t.sequenceParent.loopType == LoopType.Incremental) { if (t.isSequenced && t.sequenceParent.loopType == LoopType.Incremental) {

View File

@ -8,6 +8,7 @@
using System; using System;
using DG.Tweening.Core; using DG.Tweening.Core;
using DG.Tweening.Core.Easing; using DG.Tweening.Core.Easing;
using DG.Tweening.Core.Enums;
using DG.Tweening.Plugins.Core; using DG.Tweening.Plugins.Core;
using DG.Tweening.Plugins.Options; using DG.Tweening.Plugins.Options;
using UnityEngine; using UnityEngine;
@ -73,7 +74,7 @@ namespace DG.Tweening.Plugins
return changeValue.magnitude / unitsXSecond; return changeValue.magnitude / unitsXSecond;
} }
public override void EvaluateAndApply(VectorOptions options, Tween t, bool isRelative, DOGetter<Vector2> getter, DOSetter<Vector2> setter, float elapsed, Vector2 startValue, Vector2 changeValue, float duration, bool usingInversePosition) public override void EvaluateAndApply(VectorOptions options, Tween t, bool isRelative, DOGetter<Vector2> getter, DOSetter<Vector2> setter, float elapsed, Vector2 startValue, Vector2 changeValue, float duration, bool usingInversePosition, UpdateNotice updateNotice)
{ {
if (t.loopType == LoopType.Incremental) startValue += changeValue * (t.isComplete ? t.completedLoops - 1 : t.completedLoops); if (t.loopType == LoopType.Incremental) startValue += changeValue * (t.isComplete ? t.completedLoops - 1 : t.completedLoops);
if (t.isSequenced && t.sequenceParent.loopType == LoopType.Incremental) { if (t.isSequenced && t.sequenceParent.loopType == LoopType.Incremental) {

View File

@ -5,6 +5,7 @@
using System; using System;
using DG.Tweening.Core; using DG.Tweening.Core;
using DG.Tweening.Core.Easing; using DG.Tweening.Core.Easing;
using DG.Tweening.Core.Enums;
using DG.Tweening.Core.Surrogates; using DG.Tweening.Core.Surrogates;
using DG.Tweening.Plugins.Core; using DG.Tweening.Plugins.Core;
using DG.Tweening.Plugins.Options; using DG.Tweening.Plugins.Options;
@ -71,7 +72,7 @@ namespace DG.Tweening.Plugins
return changeValue.value.magnitude / unitsXSecond; return changeValue.value.magnitude / unitsXSecond;
} }
public override void EvaluateAndApply(VectorOptions options, Tween t, bool isRelative, DOGetter<Vector2Wrapper> getter, DOSetter<Vector2Wrapper> setter, float elapsed, Vector2Wrapper startValue, Vector2Wrapper changeValue, float duration, bool usingInversePosition) public override void EvaluateAndApply(VectorOptions options, Tween t, bool isRelative, DOGetter<Vector2Wrapper> getter, DOSetter<Vector2Wrapper> setter, float elapsed, Vector2Wrapper startValue, Vector2Wrapper changeValue, float duration, bool usingInversePosition, UpdateNotice updateNotice)
{ {
if (t.loopType == LoopType.Incremental) startValue.value += changeValue.value * (t.isComplete ? t.completedLoops - 1 : t.completedLoops); if (t.loopType == LoopType.Incremental) startValue.value += changeValue.value * (t.isComplete ? t.completedLoops - 1 : t.completedLoops);
if (t.isSequenced && t.sequenceParent.loopType == LoopType.Incremental) { if (t.isSequenced && t.sequenceParent.loopType == LoopType.Incremental) {

View File

@ -7,6 +7,7 @@
using System; using System;
using DG.Tweening.Core; using DG.Tweening.Core;
using DG.Tweening.Core.Easing; using DG.Tweening.Core.Easing;
using DG.Tweening.Core.Enums;
using DG.Tweening.Plugins.Core; using DG.Tweening.Plugins.Core;
using DG.Tweening.Plugins.Options; using DG.Tweening.Plugins.Options;
using UnityEngine; using UnityEngine;
@ -65,7 +66,7 @@ namespace DG.Tweening.Plugins
return totDuration; return totDuration;
} }
public override void EvaluateAndApply(Vector3ArrayOptions options, Tween t, bool isRelative, DOGetter<Vector3> getter, DOSetter<Vector3> setter, float elapsed, Vector3[] startValue, Vector3[] changeValue, float duration, bool usingInversePosition) public override void EvaluateAndApply(Vector3ArrayOptions options, Tween t, bool isRelative, DOGetter<Vector3> getter, DOSetter<Vector3> setter, float elapsed, Vector3[] startValue, Vector3[] changeValue, float duration, bool usingInversePosition, UpdateNotice updateNotice)
{ {
Vector3 incrementValue = Vector3.zero; Vector3 incrementValue = Vector3.zero;
if (t.loopType == LoopType.Incremental) { if (t.loopType == LoopType.Incremental) {

View File

@ -8,6 +8,7 @@
using System; using System;
using DG.Tweening.Core; using DG.Tweening.Core;
using DG.Tweening.Core.Easing; using DG.Tweening.Core.Easing;
using DG.Tweening.Core.Enums;
using DG.Tweening.Plugins.Core; using DG.Tweening.Plugins.Core;
using DG.Tweening.Plugins.Options; using DG.Tweening.Plugins.Options;
using UnityEngine; using UnityEngine;
@ -80,7 +81,7 @@ namespace DG.Tweening.Plugins
return changeValue.magnitude / unitsXSecond; return changeValue.magnitude / unitsXSecond;
} }
public override void EvaluateAndApply(VectorOptions options, Tween t, bool isRelative, DOGetter<Vector3> getter, DOSetter<Vector3> setter, float elapsed, Vector3 startValue, Vector3 changeValue, float duration, bool usingInversePosition) public override void EvaluateAndApply(VectorOptions options, Tween t, bool isRelative, DOGetter<Vector3> getter, DOSetter<Vector3> setter, float elapsed, Vector3 startValue, Vector3 changeValue, float duration, bool usingInversePosition, UpdateNotice updateNotice)
{ {
if (t.loopType == LoopType.Incremental) startValue += changeValue * (t.isComplete ? t.completedLoops - 1 : t.completedLoops); if (t.loopType == LoopType.Incremental) startValue += changeValue * (t.isComplete ? t.completedLoops - 1 : t.completedLoops);
if (t.isSequenced && t.sequenceParent.loopType == LoopType.Incremental) { if (t.isSequenced && t.sequenceParent.loopType == LoopType.Incremental) {

View File

@ -5,6 +5,7 @@
using System; using System;
using DG.Tweening.Core; using DG.Tweening.Core;
using DG.Tweening.Core.Easing; using DG.Tweening.Core.Easing;
using DG.Tweening.Core.Enums;
using DG.Tweening.Core.Surrogates; using DG.Tweening.Core.Surrogates;
using DG.Tweening.Plugins.Core; using DG.Tweening.Plugins.Core;
using DG.Tweening.Plugins.Options; using DG.Tweening.Plugins.Options;
@ -78,7 +79,7 @@ namespace DG.Tweening.Plugins
return changeValue.value.magnitude / unitsXSecond; return changeValue.value.magnitude / unitsXSecond;
} }
public override void EvaluateAndApply(VectorOptions options, Tween t, bool isRelative, DOGetter<Vector3Wrapper> getter, DOSetter<Vector3Wrapper> setter, float elapsed, Vector3Wrapper startValue, Vector3Wrapper changeValue, float duration, bool usingInversePosition) public override void EvaluateAndApply(VectorOptions options, Tween t, bool isRelative, DOGetter<Vector3Wrapper> getter, DOSetter<Vector3Wrapper> setter, float elapsed, Vector3Wrapper startValue, Vector3Wrapper changeValue, float duration, bool usingInversePosition, UpdateNotice updateNotice)
{ {
if (t.loopType == LoopType.Incremental) startValue.value += changeValue.value * (t.isComplete ? t.completedLoops - 1 : t.completedLoops); if (t.loopType == LoopType.Incremental) startValue.value += changeValue.value * (t.isComplete ? t.completedLoops - 1 : t.completedLoops);
if (t.isSequenced && t.sequenceParent.loopType == LoopType.Incremental) { if (t.isSequenced && t.sequenceParent.loopType == LoopType.Incremental) {

View File

@ -8,6 +8,7 @@
using System; using System;
using DG.Tweening.Core; using DG.Tweening.Core;
using DG.Tweening.Core.Easing; using DG.Tweening.Core.Easing;
using DG.Tweening.Core.Enums;
using DG.Tweening.Plugins.Core; using DG.Tweening.Plugins.Core;
using DG.Tweening.Plugins.Options; using DG.Tweening.Plugins.Options;
using UnityEngine; using UnityEngine;
@ -87,7 +88,7 @@ namespace DG.Tweening.Plugins
return changeValue.magnitude / unitsXSecond; return changeValue.magnitude / unitsXSecond;
} }
public override void EvaluateAndApply(VectorOptions options, Tween t, bool isRelative, DOGetter<Vector4> getter, DOSetter<Vector4> setter, float elapsed, Vector4 startValue, Vector4 changeValue, float duration, bool usingInversePosition) public override void EvaluateAndApply(VectorOptions options, Tween t, bool isRelative, DOGetter<Vector4> getter, DOSetter<Vector4> setter, float elapsed, Vector4 startValue, Vector4 changeValue, float duration, bool usingInversePosition, UpdateNotice updateNotice)
{ {
if (t.loopType == LoopType.Incremental) startValue += changeValue * (t.isComplete ? t.completedLoops - 1 : t.completedLoops); if (t.loopType == LoopType.Incremental) startValue += changeValue * (t.isComplete ? t.completedLoops - 1 : t.completedLoops);
if (t.isSequenced && t.sequenceParent.loopType == LoopType.Incremental) { if (t.isSequenced && t.sequenceParent.loopType == LoopType.Incremental) {

View File

@ -4,6 +4,7 @@
using System; using System;
using DG.Tweening.Core; using DG.Tweening.Core;
using DG.Tweening.Core.Easing; using DG.Tweening.Core.Easing;
using DG.Tweening.Core.Enums;
using DG.Tweening.Core.Surrogates; using DG.Tweening.Core.Surrogates;
using DG.Tweening.Plugins.Core; using DG.Tweening.Plugins.Core;
using DG.Tweening.Plugins.Options; using DG.Tweening.Plugins.Options;
@ -84,7 +85,7 @@ namespace DG.Tweening.Plugins
return changeValue.value.magnitude / unitsXSecond; return changeValue.value.magnitude / unitsXSecond;
} }
public override void EvaluateAndApply(VectorOptions options, Tween t, bool isRelative, DOGetter<Vector4Wrapper> getter, DOSetter<Vector4Wrapper> setter, float elapsed, Vector4Wrapper startValue, Vector4Wrapper changeValue, float duration, bool usingInversePosition) public override void EvaluateAndApply(VectorOptions options, Tween t, bool isRelative, DOGetter<Vector4Wrapper> getter, DOSetter<Vector4Wrapper> setter, float elapsed, Vector4Wrapper startValue, Vector4Wrapper changeValue, float duration, bool usingInversePosition, UpdateNotice updateNotice)
{ {
if (t.loopType == LoopType.Incremental) startValue.value += changeValue.value * (t.isComplete ? t.completedLoops - 1 : t.completedLoops); if (t.loopType == LoopType.Incremental) startValue.value += changeValue.value * (t.isComplete ? t.completedLoops - 1 : t.completedLoops);
if (t.isSequenced && t.sequenceParent.loopType == LoopType.Incremental) { if (t.isSequenced && t.sequenceParent.loopType == LoopType.Incremental) {

View File

@ -134,7 +134,7 @@ namespace DG.Tweening
return DoStartup(this); return DoStartup(this);
} }
internal override bool ApplyTween(float prevPosition, int prevCompletedLoops, int newCompletedSteps, bool useInversePosition, UpdateMode updateMode) internal override bool ApplyTween(float prevPosition, int prevCompletedLoops, int newCompletedSteps, bool useInversePosition, UpdateMode updateMode, UpdateNotice updateNotice)
{ {
return DoApplyTween(this, prevPosition, prevCompletedLoops, newCompletedSteps, useInversePosition, updateMode); return DoApplyTween(this, prevPosition, prevCompletedLoops, newCompletedSteps, useInversePosition, updateMode);
} }

View File

@ -163,8 +163,9 @@ namespace DG.Tweening
internal abstract bool Startup(); internal abstract bool Startup();
// Applies the tween set by DoGoto. // Applies the tween set by DoGoto.
// Returns TRUE if the tween needs to be killed // Returns TRUE if the tween needs to be killed.
internal abstract bool ApplyTween(float prevPosition, int prevCompletedLoops, int newCompletedSteps, bool useInversePosition, UpdateMode updateMode); // UpdateNotice is only used by Tweeners, since Sequences re-evaluate for it
internal abstract bool ApplyTween(float prevPosition, int prevCompletedLoops, int newCompletedSteps, bool useInversePosition, UpdateMode updateMode, UpdateNotice updateNotice);
#endregion #endregion
@ -231,7 +232,10 @@ namespace DG.Tweening
&& (t.position < t.duration ? t.completedLoops % 2 != 0 : t.completedLoops % 2 == 0); && (t.position < t.duration ? t.completedLoops % 2 != 0 : t.completedLoops % 2 == 0);
// Get values from plugin and set them // Get values from plugin and set them
if (t.ApplyTween(prevPosition, prevCompletedLoops, newCompletedSteps, useInversePosition, updateMode)) return true; UpdateNotice updateNotice =
!wasRewinded && (t.loopType == LoopType.Restart && t.completedLoops != prevCompletedLoops || t.position <= 0 && t.completedLoops <= 0)
? UpdateNotice.RewindStep : UpdateNotice.None;
if (t.ApplyTween(prevPosition, prevCompletedLoops, newCompletedSteps, useInversePosition, updateMode, updateNotice)) return true;
// Additional callbacks // Additional callbacks
if (t.onUpdate != null && updateMode != UpdateMode.IgnoreOnUpdate) { if (t.onUpdate != null && updateMode != UpdateMode.IgnoreOnUpdate) {

View File

@ -2187,5 +2187,21 @@
Public only so custom shortcuts can access some of these methods Public only so custom shortcuts can access some of these methods
</summary> </summary>
</member> </member>
<member name="T:DG.Tweening.Core.Enums.UpdateNotice">
<summary>
Additional notices passed to plugins when updating.
Public so it can be used by custom plugins. Internally, only PathPlugin uses it
</summary>
</member>
<member name="F:DG.Tweening.Core.Enums.UpdateNotice.None">
<summary>
None
</summary>
</member>
<member name="F:DG.Tweening.Core.Enums.UpdateNotice.RewindStep">
<summary>
Lets the plugin know that we restarted or rewinded
</summary>
</member>
</members> </members>
</doc> </doc>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.