KEngine.KAsync._CoWhen C# (CSharp) Method

_CoWhen() private method

private _CoWhen ( Func retBool, float timeout, System.Action next ) : IEnumerator
retBool Func
timeout float
next System.Action
return IEnumerator
        private IEnumerator _CoWhen(Func<bool> retBool, float timeout, Action next)
        {
            var time = 0f;
            while (!(retBool()))
            {
                time += Time.deltaTime;
                if (time > timeout)
                {
                    Log.Error("[KAsync:When]A WHEN Timeout!!!");
                    break;
                }
                yield return null;
            }

            next();
        }