allow getting a list of all active coroutines

This commit is contained in:
Ellpeck 2020-03-24 23:47:27 +01:00
parent bf792e3e73
commit b850b3bae0

View file

@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
namespace Coroutine { namespace Coroutine {
public static class CoroutineHandler { public static class CoroutineHandler {
@ -53,6 +54,10 @@ namespace Coroutine {
} }
} }
public static IEnumerable<ActiveCoroutine> GetActiveCoroutines() {
return TickingCoroutines.Concat(EventCoroutines);
}
private static IEnumerator<IWait> InvokeLaterImpl(IWait wait, Action action) { private static IEnumerator<IWait> InvokeLaterImpl(IWait wait, Action action) {
yield return wait; yield return wait;
action(); action();