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