예제 #1
0
        private static IEnumerator SelfDestroy(CoroutineRegularUpdater cru)
        {
            yield return(null);

            cru.gameObject.SetActive(false);
            yield return(null);
        }
예제 #2
0
        private static IEnumerator SelfDestroy2(CoroutineRegularUpdater cru)
        {
            yield return(null);

            cru.gameObject.SetActive(false);
            // ReSharper disable once RedundantJumpStatement
            yield break;
        }
예제 #3
0
 /// <summary>
 /// Outer waiter-- Will cb if cancelled
 /// </summary>
 public static void WaitThenCBEvenIfCancelled(CoroutineRegularUpdater Exec, ICancellee cT, float time, bool zeroToInfinity,
                                              Action cb)
 {
     cT.ThrowIfCancelled();
     if (zeroToInfinity && time < float.Epsilon)
     {
         time = float.MaxValue;
     }
     Exec.RunRIEnumerator(WaitFor(time, cT, cb));
 }
예제 #4
0
 /// <summary>
 /// Outer waiter-- Will not cb if cancelled
 /// </summary>
 public static void WaitThenCB(CoroutineRegularUpdater Exec, ICancellee cT, float time, Func <bool> condition,
                               Action cb)
 {
     cT.ThrowIfCancelled();
     Exec.RunRIEnumerator(WaitForBoth(time, condition, cT, () => {
         if (!cT.Cancelled)
         {
             cb();
         }
     }));
 }
예제 #5
0
 /// <summary>
 /// Task style. Will return as soon as the time is up or cancellation is triggered.
 /// You must check cT.IsCancelled after awaiting this.
 /// </summary>
 /// <returns></returns>
 public static Task WaitForUnchecked(CoroutineRegularUpdater Exec, ICancellee cT, float time, bool zeroToInfinity)
 {
     cT.ThrowIfCancelled();
     if (zeroToInfinity && time < float.Epsilon)
     {
         time = float.MaxValue;
     }
     if (time < float.Epsilon)
     {
         return(Task.CompletedTask);
     }
     Exec.RunRIEnumerator(WaitFor(time, cT, GetAwaiter(out Task t)));
     return(t);
 }
예제 #6
0
 /// <summary>
 /// Outer waiter-- Will not cancel if cancelled
 /// </summary>
 public static void WaitThenCancel(CoroutineRegularUpdater Exec, ICancellee cT, float time, bool zeroToInfinity,
                                   Cancellable toCancel)
 {
     cT.ThrowIfCancelled();
     if (zeroToInfinity && time < float.Epsilon)
     {
         time = float.MaxValue;
     }
     Exec.RunRIEnumerator(WaitFor(time, cT, () => {
         if (!cT.Cancelled)
         {
             toCancel.Cancel();
         }
     }));
 }
예제 #7
0
 private void Awake()
 {
     Main = this;
 }
예제 #8
0
 /// <summary>
 /// Task style. Will return as soon as the condition is satisfied or cancellation is triggered.
 /// You must check cT.IsCancelled after awaiting this.
 /// </summary>
 /// <returns></returns>
 public static Task WaitForUnchecked(CoroutineRegularUpdater Exec, ICancellee cT, Func <bool> condition)
 {
     cT.ThrowIfCancelled();
     Exec.RunRIEnumerator(WaitFor(condition, cT, GetAwaiter(out Task t)));
     return(t);
 }