コード例 #1
0
ファイル: Coroutine.cs プロジェクト: 741645596/Lab
        public YCContext(IEnumerator c, GameObject owner)
        {
            coroutine = c;
            currYield = coroutine.Current as IYYieldInstruction;

            this.owner = owner;
            hasOwner   = (owner != null);
        }
コード例 #2
0
ファイル: Coroutine.cs プロジェクト: 741645596/Lab
        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;
                }
            }
        }