protected virtual void OnStop() { mExecs.Clear(); mStack.Clear(); mFileStack.Clear(); mResult = null; mTask = null; Heap.ResetStack(); mFile.SetNextMark(0); IsComplete = true; }
public virtual void Update(float deltaTime) { if (IsComplete) { return; } if (mTask != null) { mTask.Update(deltaTime); } if (mResult != null && mResult.State == ESitcomState.Doing) { return; } while (mExecs.Count > 0 || mStack.Count > 0) { while (mExecs.Count > 0) { var t = mExecs.Dequeue(); t.OnExecute(this); if (t is SitcomCmdSequence) { mFileStack.Add(t as SitcomCmdSequence); } mStack.Push(t); } if (mStack.Count > 0) { var t = mStack.Pop(); t.OnStop(this); if (t is SitcomCmdSequence) { mFileStack.Remove(t as SitcomCmdSequence); } mResult = t.Result; if (mResult != null && mResult.State == ESitcomState.Doing) { mTask = mResult as ISitcomTask; return; } mTask = null; } } OnStop(); }