Skip to content

Commit

Permalink
Effect runner
Browse files Browse the repository at this point in the history
  • Loading branch information
mob-sakai committed Oct 6, 2018
1 parent 0c1468b commit 3215160
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public class EffectRunner

static List<Action> s_UpdateActions;

public void OnEnable(Action<float> callback)
public void OnEnable(Action<float> callback = null)
{

if (s_UpdateActions == null)
Expand All @@ -63,7 +63,7 @@ public void OnEnable(Action<float> callback)
s_UpdateActions.Add(OnWillRenderCanvases);

_time = 0;
this._callback = callback;
_callback = callback;
}

/// <summary>
Expand All @@ -78,10 +78,14 @@ public void OnDisable()
/// <summary>
/// Play runner.
/// </summary>
public void Play()
public void Play(Action<float> callback = null)
{
_time = 0;
running = true;
if(callback != null)
{
_callback = callback;
}
}

//################################
Expand All @@ -92,7 +96,7 @@ public void Play()

void OnWillRenderCanvases()
{
if (!running || !Application.isPlaying)
if (!running || !Application.isPlaying || _callback == null)
{
return;
}
Expand Down

0 comments on commit 3215160

Please sign in to comment.