Skip to content

Instantly share code, notes, and snippets.

@hk1ll3r
Created February 5, 2020 23:15
Show Gist options
  • Save hk1ll3r/fe22084ab0df59d84ea58e9fa6466181 to your computer and use it in GitHub Desktop.
Save hk1ll3r/fe22084ab0df59d84ea58e9fa6466181 to your computer and use it in GitHub Desktop.
public class Buff : MonoBehaviour
{
public void OnBuff()
{
Debug.Log("buffed!");
RunDelayed(2f, () => {
Debug.Log("debuffed!");
});
}
protected IEnumerator DelayedCoroutine(float delay, System.Action a)
{
yield return new WaitForSeconds(delay);
a();
}
protected Coroutine RunDelayed(float delay, System.Action a)
{
return StartCoroutine(DelayedCoroutine(delay, a));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment