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

SetRelative now works with Sequences too (sets all nested tweens as relative)

This commit is contained in:
Daniele Giardini 2015-06-11 21:20:55 +02:00
parent 7b9cb9f7d6
commit 8b77246cfc
13 changed files with 13 additions and 5 deletions

View File

@ -16,6 +16,6 @@ public class Jump : BrainBase
{ {
yield return new WaitForSeconds(1); yield return new WaitForSeconds(1);
target.DOJump(jump, jumpHeight, numJumps, duration).SetEase(ease).SetLoops(loops, LoopType.Yoyo); target.DOJump(jump, jumpHeight, numJumps, duration).SetEase(ease).SetLoops(loops, LoopType.Yoyo).SetRelative();
} }
} }

View File

@ -7,15 +7,17 @@ using DG.Tweening.Core;
using UnityEngine; using UnityEngine;
using UnityEngine.UI; using UnityEngine.UI;
public class TempTests : MonoBehaviour public class TempTests : BrainBase
{ {
public bool straightFixedUpdate; public Transform trans;
public Renderer rend;
IEnumerator Start() IEnumerator Start()
{ {
yield return new WaitForSeconds(1); yield return new WaitForSeconds(1);
Tween t = transform.DORotate(new Vector3(0, 180, 0), 2).OnComplete(()=> Debug.Log("Complete")); DOTween.Sequence()
if (straightFixedUpdate) t.SetUpdate(UpdateType.Fixed); .Append(rend.material.DOFade(0, 0.5f))
.Append(rend.material.DOFade(1, 1f));
} }
} }

View File

@ -163,6 +163,12 @@ namespace DG.Tweening
s.fullDuration = s.loops > -1 ? s.duration * s.loops : Mathf.Infinity; s.fullDuration = s.loops > -1 ? s.duration * s.loops : Mathf.Infinity;
// Order sequencedObjs by start position // Order sequencedObjs by start position
s._sequencedObjs.Sort(SortSequencedObjs); s._sequencedObjs.Sort(SortSequencedObjs);
// Set relative nested tweens
if (s.isRelative) {
for (int len = s.sequencedTweens.Count, i = 0; i < len; ++i) {
s.sequencedTweens[i].isRelative = true;
}
}
return true; return true;
} }

Binary file not shown.