public YCContext(IEnumerator c, GameObject owner) { coroutine = c; currYield = coroutine.Current as IYYieldInstruction; this.owner = owner; hasOwner = (owner != null); }
public void Step() { if (isFinished || hasOwner && owner == null) { // 已经完成了,嘛也不干 return; } if (currYield != null && currYield.IsFinished()) { currYield = null; } if (currYield == null) { if (!coroutine.MoveNext()) { isFinished = true; } else { currYield = coroutine.Current as IYYieldInstruction; } } }