Last active
June 1, 2016 13:58
-
-
Save x5lcfd/ff676893f6d5bf5c0765 to your computer and use it in GitHub Desktop.
update usage
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
IEnumerator Waiting(TimeSpan elapsedTimeSpan, | |
System.Action<TimeSpan> timeCallback, | |
System.Action callback) | |
{ | |
for (;elapsedTimeSpan.CompareTo(TimeSpan.Zero) >= 0;) | |
{ | |
if (timeCallback != null) { timeCallback(elapsedTimeSpan); } | |
elapsedTimeSpan -= new TimeSpan(0, 0, 1); | |
yield return new WaitForSeconds(1.0f); | |
} | |
if (callback != null) | |
{ | |
callback(); | |
} | |
} | |
//Usage | |
// | |
//var cdCoroutine = cd.Waiting( new System.TimeSpan(0, 0, 10), | |
// elapsedTime => | |
// { | |
// timeValue.text = string.Format( "{0:dd\\.hh\\:mm\\:ss}", elapsedTime ); | |
// }, | |
// null ); | |
// | |
//StartCoroutine( cdCoroutine ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment