Cesium for Unity 1.15.2
Loading...
Searching...
No Matches
NativeCoroutine.cs
Go to the documentation of this file.
1using System;
2using System.Collections;
3
4namespace CesiumForUnity
5{
6 internal partial class NativeCoroutine : IEnumerable
7 {
8 private Func<object, object> _callback;
9
10 public NativeCoroutine(Func<object, object> callback)
11 {
12 _callback = callback;
13 }
14
15 public IEnumerator GetEnumerator()
16 {
17 // We're using the callback instance itself as a
18 // an opaque sentinel that indicates "end the coroutine".
19 object sentinel = this._callback;
20 object next = this._callback(sentinel);
21 while (next != sentinel)
22 {
23 yield return next;
24 next = this._callback(sentinel);
25 }
26 }
27 }
28}