Created
November 17, 2016 10:13
-
-
Save is8r/7561e2b0d1d4da0d31f9cee22ca5a022 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
using System; | |
using System.Collections.Generic; | |
public static class MonoBehaviorExtentsion | |
{ | |
public static IEnumerator DelayMethod<T>(this MonoBehaviour mono, float waitTime, Action<T> action, T t) | |
{ | |
yield return new WaitForSeconds(waitTime); | |
action(t); | |
} | |
public static IEnumerator DelayMethod(this MonoBehaviour mono, float waitTime, Action action) | |
{ | |
yield return new WaitForSeconds(waitTime); | |
action(); | |
} | |
public static Coroutine Delay<T>(this MonoBehaviour mono, float waitTime, Action<T> action, T t) | |
{ | |
return mono.StartCoroutine(DelayMethod(mono, waitTime, action, t)); | |
} | |
public static Coroutine Delay(this MonoBehaviour mono, float waitTime, Action action) | |
{ | |
return mono.StartCoroutine(DelayMethod(mono, waitTime, action)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment