Skip to content

Commit

Permalink
Fixed OnPlay being called immediately (after the first run) in spite …
Browse files Browse the repository at this point in the history
…of eventual delays
  • Loading branch information
Demigiant committed Feb 9, 2016
1 parent 0d75335 commit 51ad722
Show file tree
Hide file tree
Showing 45 changed files with 23 additions and 8 deletions.
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 modified UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween.dll
Binary file not shown.
Binary file modified UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween.dll.mdb
Binary file not shown.
Binary file modified UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween43.dll
Binary file not shown.
Binary file modified UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween43.dll.mdb
Binary file not shown.
Binary file modified UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween46.dll
Binary file not shown.
Binary file modified UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween46.dll.mdb
Binary file not shown.
Binary file modified UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween50.dll
Binary file not shown.
Binary file modified UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween50.dll.mdb
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween.dll
Binary file not shown.
Binary file modified UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween.dll.mdb
Binary file not shown.
Binary file modified UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween43.dll
Binary file not shown.
Binary file modified UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween43.dll.mdb
Binary file not shown.
Binary file modified UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween46.dll
Binary file not shown.
Binary file modified UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween46.dll.mdb
Binary file not shown.
Binary file modified UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween50.dll
Binary file not shown.
Binary file modified UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween50.dll.mdb
Binary file not shown.
Binary file not shown.
Binary file not shown.
5 changes: 5 additions & 0 deletions UnityTests.Unity5/Assets/_Tests PRO/TempPro.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,9 @@ public void OnCreated()
{
Debug.Log("Tween created > " + anime.tween);
}

public void Output()
{
Debug.Log("HERE");
}
}
Binary file modified UnityTests.Unity5/Assets/_Tests PRO/TempPro.unity
Binary file not shown.
11 changes: 8 additions & 3 deletions UnityTests.Unity5/Assets/_Tests/TempTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
13 changes: 9 additions & 4 deletions _DOTween.Assembly/DOTween/Core/TweenManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,11 @@ internal static void Update(UpdateType updateType, float deltaTime, float indepe
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) {
Expand Down Expand Up @@ -583,8 +588,8 @@ internal static bool Play(Tween t)
{
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;
Expand Down Expand Up @@ -618,8 +623,8 @@ internal static bool Restart(Tween t, bool includeDelay = true)
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;
Expand Down
2 changes: 1 addition & 1 deletion _DOTween.Assembly/DOTween/DOTween.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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 ////////////////////////////////////
Expand Down
Binary file modified _DOTween.Assembly/bin/DOTween.dll
Binary file not shown.
Binary file modified _DOTween.Assembly/bin/DOTween.dll.mdb
Binary file not shown.
Binary file modified _DOTween.Assembly/bin/DOTween43.dll
Binary file not shown.
Binary file modified _DOTween.Assembly/bin/DOTween43.dll.mdb
Binary file not shown.
Binary file modified _DOTween.Assembly/bin/DOTween46.dll
Binary file not shown.
Binary file modified _DOTween.Assembly/bin/DOTween46.dll.mdb
Binary file not shown.
Binary file modified _DOTween.Assembly/bin/DOTween50.dll
Binary file not shown.
Binary file modified _DOTween.Assembly/bin/DOTween50.dll.mdb
Binary file not shown.
Binary file modified _DOTween.Assembly/bin/Editor/DOTweenEditor.dll
Binary file not shown.
Binary file modified _DOTween.Assembly/bin/Editor/DOTweenEditor.dll.mdb
Binary file not shown.

0 comments on commit 51ad722

Please sign in to comment.