示例#1
0
        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();
        }
示例#2
0
        /// <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));
        }
示例#3
0
 /// <summary> Unpause all CoRoutines with given CoTag. </summary>
 public static void UnpauseCoRoutines(CoTag coTag)
 {
     OrderToCoRoutinesViaCoTag?.Invoke(CallbackOrder.Unpause, coTag);
 }
示例#4
0
        /// <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);
        }
示例#5
0
 /// <summary> Kill all CoRoutines with given CoTag. </summary>
 public static void KillCoRoutines(CoTag coTag)
 {
     OrderToCoRoutinesViaCoTag?.Invoke(CallbackOrder.Kill, coTag);
 }