Created
February 5, 2020 23:23
-
-
Save hk1ll3r/76a13d6dbb567e36b856a9a586249965 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
public class MyMonoBehaviour : MonoBehaviour { | |
protected IEnumerator DelayedCoroutine(float delay, System.Action a) | |
{ | |
yield return new WaitForSecondsRealtime(delay); | |
a(); | |
} | |
protected Coroutine RunDelayed(float delay, System.Action a) | |
{ | |
return StartCoroutine(DelayedCoroutine(delay, a)); | |
} | |
} | |
public class Buff : MyMonoBehaviour | |
{ | |
public void OnBuff() | |
{ | |
StopAllCoroutines(); | |
Debug.Log("buffed!"); | |
RunDelayed(2f, () => { | |
Debug.Log("debuffed!"); | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment