Skip to content

Commit

Permalink
feat(ColorTweener): Add callback
Browse files Browse the repository at this point in the history
  • Loading branch information
jcs090218 committed Jul 20, 2024
1 parent 458cb0e commit dea928c
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions Assets/JCSUnity/Scripts/Effects/Tweener/JCS_ColorTweener.cs
Original file line number Diff line number Diff line change
Expand Up @@ -283,14 +283,15 @@ public void ResetTweener()
/// Tween to the color.
/// </summary>
/// <param name="inToColor"> target color </param>
public void DoTween(Color inToColor)
public void DoTween(Color inToColor, EmptyFunction func = null)
{
DoTween(
inToColor,
this.mEaseTypeR,
this.mEaseTypeG,
this.mEaseTypeB,
this.mEaseTypeR);
this.mEaseTypeR,
func);
}

/// <summary>
Expand All @@ -306,7 +307,8 @@ public void DoTween(
JCS_TweenType inTweenTypeR,
JCS_TweenType inTweenTypeG,
JCS_TweenType inTweenTypeB,
JCS_TweenType inTweenTypeA)
JCS_TweenType inTweenTypeA,
EmptyFunction func = null)
{
DoTween(
this.LocalColor,
Expand All @@ -318,7 +320,8 @@ public void DoTween(
this.mDurationRed,
this.mDurationGreen,
this.mDurationBlue,
this.mDurationAlpha);
this.mDurationAlpha,
func);
}

/// <summary>
Expand All @@ -344,7 +347,8 @@ public void DoTween(
float inDurationR,
float inDurationG,
float inDurationB,
float inDurationA)
float inDurationA,
EmptyFunction func = null)
{
this.mFromColor = inFromColor;
this.mTargetColor = inToColor;
Expand All @@ -363,6 +367,8 @@ public void DoTween(
this.mEasingG = true;
this.mEasingB = true;
this.mEasingA = true;

SetCallback(func);
}

/// <summary>
Expand Down Expand Up @@ -514,7 +520,6 @@ private void CheckDoneEasing()
if (mEasingA || mEasingR || mEasingG || mEasingB)
return;


// trigger callback.
if (mColorCallback != null)
mColorCallback.Invoke();
Expand Down

0 comments on commit dea928c

Please sign in to comment.