public bool MoveNext()
        {
            IEnumerator leaf = YieldUtils.GetLeafEnumerator(_current);

            if (leaf != null && leaf != _current)
            {
                while (leaf != null && !leaf.MoveNext())
                {
                    leaf = YieldUtils.GetLeafEnumerator(_current, leaf);
                }
                if (leaf == null && !_current.MoveNext())
                {
                    if (_coroutines.Count == 0)
                    {
                        return(false);
                    }

                    _current = _coroutines.Dequeue();
                }
            }
            else if (!_current.MoveNext())
            {
                if (_coroutines.Count == 0)
                {
                    return(false);
                }

                _current = _coroutines.Dequeue();
            }

            return(true);
        }
        public bool MoveNext()
        {
            for (var i = _coroutines.Count - 1; i >= 0; --i)
            {
                // find leaf enumerator to move next on
                IEnumerator leaf = YieldUtils.GetLeafEnumerator(_coroutines[i]);
                if (leaf != null && leaf != _coroutines[i])
                {
                    while (leaf != null && !leaf.MoveNext())
                    {
                        leaf = YieldUtils.GetLeafEnumerator(_coroutines[i], leaf);
                    }
                    if (leaf == null && !_coroutines[i].MoveNext())
                    {
                        _coroutines.RemoveAt(i);
                    }
                }
                else if (!_coroutines[i].MoveNext())
                {
                    _coroutines.RemoveAt(i);
                }
            }

            if (_coroutines.Count == 0)
            {
                return(false);
            }

            return(true);
        }