mirror of
https://github.com/Cardidi/dotween-upm-fork.git
synced 2026-03-26 22:49:03 +08:00
Fixed OnPlay being called immediately (after the first run) in spite of eventual delays
This commit is contained in:
parent
0d75335df2
commit
51ad72269d
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -15,4 +15,9 @@ public class TempPro : MonoBehaviour
|
||||
{
|
||||
Debug.Log("Tween created > " + anime.tween);
|
||||
}
|
||||
|
||||
public void Output()
|
||||
{
|
||||
Debug.Log("HERE");
|
||||
}
|
||||
}
|
||||
Binary file not shown.
@ -12,9 +12,14 @@ public class TempTests : BrainBase
|
||||
{
|
||||
public Transform target;
|
||||
|
||||
void Start()
|
||||
IEnumerator Start()
|
||||
{
|
||||
Sequence s = DOTween.Sequence()
|
||||
.Append(target.DOMoveX(2, 2));
|
||||
Tween t = target.DOMoveX(2, 1).OnPlay(()=>Debug.Log("PLAY")).SetAutoKill(false);
|
||||
t.SetDelay(1);
|
||||
|
||||
yield return new WaitForSeconds(2.5f);
|
||||
|
||||
t.Rewind();
|
||||
t.Play();
|
||||
}
|
||||
}
|
||||
@ -353,6 +353,11 @@ namespace DG.Tweening.Core
|
||||
continue;
|
||||
}
|
||||
if (tDeltaTime <= 0) continue;
|
||||
// Delay elapsed - call OnPlay if required
|
||||
if (t.playedOnce && t.onPlay != null) {
|
||||
// Don't call in case it hasn't started because onStart routine will call it
|
||||
Tween.OnTweenCallback(t.onPlay);
|
||||
}
|
||||
}
|
||||
// Startup (needs to be here other than in Tween.DoGoto in case of speed-based tweens, to calculate duration correctly)
|
||||
if (!t.startupDone) {
|
||||
@ -583,8 +588,8 @@ namespace DG.Tweening.Core
|
||||
{
|
||||
if (!t.isPlaying && (!t.isBackwards && !t.isComplete || t.isBackwards && (t.completedLoops > 0 || t.position > 0))) {
|
||||
t.isPlaying = true;
|
||||
if (t.playedOnce && t.onPlay != null) {
|
||||
// Don't call in case it hasn't started because onStart routine will call it
|
||||
if (t.playedOnce && t.delayComplete && t.onPlay != null) {
|
||||
// Don't call in case there's a delay to run or if it hasn't started because onStart routine will call it
|
||||
Tween.OnTweenCallback(t.onPlay);
|
||||
}
|
||||
return true;
|
||||
@ -618,8 +623,8 @@ namespace DG.Tweening.Core
|
||||
t.isBackwards = false;
|
||||
Rewind(t, includeDelay);
|
||||
t.isPlaying = true;
|
||||
if (wasPaused && t.playedOnce && t.onPlay != null) {
|
||||
// Don't call in case it hasn't started because onStart routine will call it
|
||||
if (wasPaused && t.playedOnce && t.delayComplete && t.onPlay != null) {
|
||||
// Don't call in case there's a delay to run or if it hasn't started because onStart routine will call it
|
||||
Tween.OnTweenCallback(t.onPlay);
|
||||
}
|
||||
return true;
|
||||
|
||||
@ -32,7 +32,7 @@ namespace DG.Tweening
|
||||
public class DOTween
|
||||
{
|
||||
/// <summary>DOTween's version</summary>
|
||||
public static readonly string Version = "1.1.155";
|
||||
public static readonly string Version = "1.1.160";
|
||||
|
||||
///////////////////////////////////////////////
|
||||
// Options ////////////////////////////////////
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user