public static IFpromise WaitUntil(Func <bool> condition) { var promise = new Fpromise(); var routine = _ResolveAfterCondition(promise, condition); Fcoroutine.Start(routine); return(promise); }
public static IFpromise WaitForEndOfFrame() { var promise = new Fpromise(); var routine = _ResolverAfterEndOfFrame(promise); Fcoroutine.Start(routine); return(promise); }
public static IFpromise WaitForSeconds(float seconds) { var promise = new Fpromise(); var routine = _ResolveAfterSeconds(promise, seconds); Fcoroutine.Start(routine); return(promise); }
public static IFpromise WaitUntilOrForSeconds(Func <bool> condition, float secondsToReject) { var promise = new Fpromise(); var routine = _ResolveAfterCondition(promise, condition); var coroutine = Fcoroutine.Start(routine); WaitForSeconds(secondsToReject) .Then(() => { if (coroutine != null) { Fcoroutine.Stop(coroutine); } promise.SoftReject(new Exception("FpromiseWaitUntilOrForSecondsTimeoutException")); }); return(promise); }