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

SetLink: added CompleteOnDisable, CompleteAndKillOnDisable, RewindOnDisable, RewindAndKillOnDisable

This commit is contained in:
Daniele Giardini 2019-10-17 11:12:05 +02:00
parent c0baf69eab
commit 95f160aad2
18 changed files with 60 additions and 9 deletions

View File

@ -1004,6 +1004,18 @@
<member name="F:DG.Tweening.LinkBehaviour.KillOnDestroy"> <member name="F:DG.Tweening.LinkBehaviour.KillOnDestroy">
<summary>Kills the tween when the link target is destroyed (becomes NULL). This is always active even if another behaviour is chosen</summary> <summary>Kills the tween when the link target is destroyed (becomes NULL). This is always active even if another behaviour is chosen</summary>
</member> </member>
<member name="F:DG.Tweening.LinkBehaviour.CompleteOnDisable">
<summary>Completes the tween when the link target is disabled</summary>
</member>
<member name="F:DG.Tweening.LinkBehaviour.CompleteAndKillOnDisable">
<summary>Completes and kills the tween when the link target is disabled</summary>
</member>
<member name="F:DG.Tweening.LinkBehaviour.RewindOnDisable">
<summary>Rewinds the tween (delay excluded) when the link target is disabled</summary>
</member>
<member name="F:DG.Tweening.LinkBehaviour.RewindAndKillOnDisable">
<summary>Rewinds and kills the tween when the link target is disabled</summary>
</member>
<member name="T:DG.Tweening.PathMode"> <member name="T:DG.Tweening.PathMode">
<summary> <summary>
Path mode (used to determine correct LookAt orientation) Path mode (used to determine correct LookAt orientation)

View File

@ -11,14 +11,17 @@ using UnityEngine.UI;
public class TempTests : BrainBase public class TempTests : BrainBase
{ {
public Transform target; Tween _tScale, _tMove;
Tween t;
IEnumerator Start() void Start()
{ {
target.DOBlendablePunchRotation(new Vector3(120, 120, 120), 1); _tScale = transform.DOScale(0.5f, 1).SetLoops(999);
yield return new WaitForSeconds(0.3f); _tMove = transform.DOMoveX(2, 1).SetLoops(999);
Debug.Log(target.eulerAngles); }
target.DOBlendablePunchRotation(new Vector3(200, 200, 200), 1);
void OnDisable()
{
_tScale.Complete();
_tMove.Complete();
} }
} }

View File

@ -944,7 +944,7 @@ namespace DG.Tweening.Core
if (!_TweenLinks.TryGetValue(t, out tLink)) return; if (!_TweenLinks.TryGetValue(t, out tLink)) return;
if (tLink.target == null) { if (tLink.target == null) {
t.active = false; t.active = false; // Will be killed by rest of Update loop
} else { } else {
bool goActive = tLink.target.activeInHierarchy; bool goActive = tLink.target.activeInHierarchy;
bool justEnabled = !tLink.lastSeenActive && goActive; bool justEnabled = !tLink.lastSeenActive && goActive;
@ -954,6 +954,22 @@ namespace DG.Tweening.Core
case LinkBehaviour.KillOnDisable: case LinkBehaviour.KillOnDisable:
if (!goActive) t.active = false; // Will be killed by rest of Update loop if (!goActive) t.active = false; // Will be killed by rest of Update loop
break; break;
case LinkBehaviour.CompleteAndKillOnDisable:
if (goActive) break;
if (!t.isComplete) t.Complete();
t.active = false; // Will be killed by rest of Update loop
break;
case LinkBehaviour.RewindAndKillOnDisable:
if (goActive) break;
t.Rewind(false);
t.active = false; // Will be killed by rest of Update loop
break;
case LinkBehaviour.CompleteOnDisable:
if (justDisabled && !t.isComplete) t.Complete();
break;
case LinkBehaviour.RewindOnDisable:
if (justDisabled) t.Rewind(false);
break;
case LinkBehaviour.PauseOnDisable: case LinkBehaviour.PauseOnDisable:
if (justDisabled && t.isPlaying) Pause(t); if (justDisabled && t.isPlaying) Pause(t);
break; break;

View File

@ -34,7 +34,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.2.283"; // Last version before modules: 1.1.755 public static readonly string Version = "1.2.290"; // Last version before modules: 1.1.755
/////////////////////////////////////////////// ///////////////////////////////////////////////
// Options //////////////////////////////////// // Options ////////////////////////////////////

View File

@ -24,5 +24,13 @@ namespace DG.Tweening
KillOnDisable, KillOnDisable,
/// <summary>Kills the tween when the link target is destroyed (becomes NULL). This is always active even if another behaviour is chosen</summary> /// <summary>Kills the tween when the link target is destroyed (becomes NULL). This is always active even if another behaviour is chosen</summary>
KillOnDestroy, KillOnDestroy,
/// <summary>Completes the tween when the link target is disabled</summary>
CompleteOnDisable,
/// <summary>Completes and kills the tween when the link target is disabled</summary>
CompleteAndKillOnDisable,
/// <summary>Rewinds the tween (delay excluded) when the link target is disabled</summary>
RewindOnDisable,
/// <summary>Rewinds and kills the tween when the link target is disabled</summary>
RewindAndKillOnDisable,
} }
} }

View File

@ -1004,6 +1004,18 @@
<member name="F:DG.Tweening.LinkBehaviour.KillOnDestroy"> <member name="F:DG.Tweening.LinkBehaviour.KillOnDestroy">
<summary>Kills the tween when the link target is destroyed (becomes NULL). This is always active even if another behaviour is chosen</summary> <summary>Kills the tween when the link target is destroyed (becomes NULL). This is always active even if another behaviour is chosen</summary>
</member> </member>
<member name="F:DG.Tweening.LinkBehaviour.CompleteOnDisable">
<summary>Completes the tween when the link target is disabled</summary>
</member>
<member name="F:DG.Tweening.LinkBehaviour.CompleteAndKillOnDisable">
<summary>Completes and kills the tween when the link target is disabled</summary>
</member>
<member name="F:DG.Tweening.LinkBehaviour.RewindOnDisable">
<summary>Rewinds the tween (delay excluded) when the link target is disabled</summary>
</member>
<member name="F:DG.Tweening.LinkBehaviour.RewindAndKillOnDisable">
<summary>Rewinds and kills the tween when the link target is disabled</summary>
</member>
<member name="T:DG.Tweening.PathMode"> <member name="T:DG.Tweening.PathMode">
<summary> <summary>
Path mode (used to determine correct LookAt orientation) Path mode (used to determine correct LookAt orientation)

Binary file not shown.