Пример #1
0
        public static IFpromise WaitUntil(Func <bool> condition)
        {
            var promise = new Fpromise();

            var routine = _ResolveAfterCondition(promise, condition);

            Fcoroutine.Start(routine);

            return(promise);
        }
Пример #2
0
        public static IFpromise WaitForEndOfFrame()
        {
            var promise = new Fpromise();

            var routine = _ResolverAfterEndOfFrame(promise);

            Fcoroutine.Start(routine);

            return(promise);
        }
Пример #3
0
        public static IFpromise WaitForSeconds(float seconds)
        {
            var promise = new Fpromise();

            var routine = _ResolveAfterSeconds(promise, seconds);

            Fcoroutine.Start(routine);

            return(promise);
        }
Пример #4
0
        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);
        }