Created
June 6, 2012 09:46
-
-
Save AngryAnt/2880988 to your computer and use it in GitHub Desktop.
Stab at easing the delayed invoke of whatever (untested).
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
| void InvokeDelayed (Action action, float seconds) | |
| { | |
| StartCoroutine (DoInvokeDelayed (action, seconds)); | |
| } | |
| IEnumerator DoInvokeDelayed (Action action, float seconds) | |
| { | |
| yield return new WaitForSeconds (seconds); | |
| action (); | |
| } | |
| // Use | |
| InvokeDelayed (() => { ShootAtAllOfTheThing (withThis, andThat, alsoThisOne); }, 1.0f); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment