summaryrefslogtreecommitdiff
path: root/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/IEnumeratorExtensions.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/IEnumeratorExtensions.cs')
-rw-r--r--Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/IEnumeratorExtensions.cs38
1 files changed, 38 insertions, 0 deletions
diff --git a/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/IEnumeratorExtensions.cs b/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/IEnumeratorExtensions.cs
new file mode 100644
index 00000000..30bd9f66
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/IEnumeratorExtensions.cs
@@ -0,0 +1,38 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+
+
+namespace
+ DepthFirstScheduler
+{
+ public static class IEnumeratorExtensions
+ {
+ [Obsolete("Use CoroutineToEnd")]
+ public static void CoroutinetoEnd(this IEnumerator coroutine)
+ {
+ CoroutineToEnd(coroutine);
+ }
+
+ public static void CoroutineToEnd(this IEnumerator coroutine)
+ {
+ var stack = new Stack<IEnumerator>();
+ stack.Push(coroutine);
+ while (stack.Count > 0)
+ {
+ if (stack.Peek().MoveNext())
+ {
+ var nested = stack.Peek().Current as IEnumerator;
+ if (nested != null)
+ {
+ stack.Push(nested);
+ }
+ }
+ else
+ {
+ stack.Pop();
+ }
+ }
+ }
+ }
+}