internal CoRoutine(IEnumerator <ICoData> enumerator, uint coId, CoSegment coSegment, CoTag coTag, uint coMask) { CoSegment = coSegment; CoTag = coTag; CoMask = coMask; _SecondsToWait = 0f; _CoId = coId; _Enumerator = enumerator; _CoState = CoState.Running; Register(); }
/// <summary> Yield return this to make CoRoutine wait until the other CoRoutine is alive. </summary> public static ICoData WaitUntilDone(IEnumerator <ICoData> newCoRoutine, CoSegment coSegment = CoSegment.Normal, CoTag coTag = default, uint coMask = 0) { ICoHandle coRoutine = RunCoRoutine(newCoRoutine, coSegment, coTag, coMask); return(new CoDataWaitUntilDone(coRoutine)); }
/// <summary> Unpause all CoRoutines with given CoTag. </summary> public static void UnpauseCoRoutines(CoTag coTag) { OrderToCoRoutinesViaCoTag?.Invoke(CallbackOrder.Unpause, coTag); }
/// <summary> Creates new CoRoutine and perform first execution if the CoSegment is the same as current one. </summary> public static ICoHandle RunCoRoutine(IEnumerator <ICoData> newCoRoutine, CoSegment coSegment = CoSegment.Normal, CoTag coTag = default, uint coMask = 0) { CoRoutine coRoutine = new CoRoutine(newCoRoutine, GetNextCoId, coSegment, coTag, coMask); AddNewCoRoutine(coRoutine); if (_CurrentEngineTickSegment == coSegment || (_CurrentExecutedCoRoutine != null && _CurrentExecutedCoRoutine.Value.CoSegment == coSegment)) { coRoutine.MoveCoRoutine(_DeltaTime); coRoutine.InnerCreatedAndMoved = true; } return(coRoutine); }
/// <summary> Kill all CoRoutines with given CoTag. </summary> public static void KillCoRoutines(CoTag coTag) { OrderToCoRoutinesViaCoTag?.Invoke(CallbackOrder.Kill, coTag); }