private IEnumerator __DelayFunction(VanillaFunction call, float time) { if (time <= 0f) { yield return(0f); } else { yield return(new WaitForSeconds(time)); } call(); }
/// <summary> /// For delaying a function call by a single frame. /// </summary> /// <param name="Call">Parameter-less function</param> /// <param name="Time">How long to delay by. To delay by 1 frame, Time == 0.</param> /// <returns></returns> public static void DelayFunction(VanillaFunction Call, float Time) { GetSelf()._delayFunction(Call, Time); }
private void _delayFunction(VanillaFunction call, float time) { StartCoroutine(__DelayFunction(call, time)); }
/// <summary> /// For delaying a function call by a single frame. /// </summary> /// <param name="Call">Parameter-less function</param> /// <param name="Time">How long to delay by. To delay by 1 frame, Time == 0.</param> /// <returns></returns> public static void DelayFunction(VanillaFunction Call, float Time) { instance.StartCoroutine(instance._delayFunction(Call, Time)); }