Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Assets/Plugins/LTDescr.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ public interface LTDescr
LTDescr setLoopPingPong();
LTDescr setLoopPingPong(int loops);
LTDescr setLoopType(LeanTweenType loopType);
LTDescr setOnDestroyed(Action onDestroyed);
LTDescr setOnComplete(Action onComplete);
LTDescr setOnComplete(Action<object> onComplete);
LTDescr setOnComplete(Action<object> onComplete, object onCompleteParam);
Expand Down
10 changes: 10 additions & 0 deletions Assets/Plugins/LeanTween.cs
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ public class LTDescrImpl : LTDescr {
public LeanTweenType tweenType { get; set; }
public AnimationCurve animationCurve { get; set; }
public LeanTweenType loopType { get; set; }
public bool hasOnDestroyedCallback { get { return this.onDestroyed != null; } }
public bool hasUpdateCallback { get; set; }
public Action<float> onUpdateFloat { get; set; }
public Action<float,float> onUpdateFloatRatio { get; set; }
Expand All @@ -273,6 +274,7 @@ public class LTDescrImpl : LTDescr {
public Action<Vector3> onUpdateVector3 { get; set; }
public Action<Vector3,object> onUpdateVector3Object { get; set; }
public Action<Color> onUpdateColor { get; set; }
public Action onDestroyed { get; set; }
public Action onComplete { get; set; }
public Action<object> onCompleteObject { get; set; }
public object onCompleteParam { get; set; }
Expand Down Expand Up @@ -901,6 +903,11 @@ public LTDescr setLoopPingPong( int loops ) {
return this;
}

public LTDescr setOnDestroyed(Action onDestroyed){
this.onDestroyed = onDestroyed;
return this;
}

/**
* Have a method called when the tween finishes
* @method setOnComplete
Expand Down Expand Up @@ -1430,6 +1437,9 @@ public static void update() {
}

if(trans==null){
if (tweens[i].hasOnDestroyedCallback){
tweens[i].onDestroyed();
}
removeTween(i);
continue;
}
Expand Down