static void RegisterInCallerOverTime(FunctionAndParams p_struct, float p_time) { if (p_struct != null) { if (p_time <= 0) { p_struct.CallFunction(); } else { FunctionsToCallOverTime.AddChecking(p_time, p_struct); } } }
static void ProcessStaticTime() { bool v_needClean = false; System.DateTime v_utfNow = System.DateTime.UtcNow; double v_seconds = (v_utfNow - _lastCheckedTime).TotalSeconds; _lastCheckedTime = v_utfNow; foreach (KVPair <float, FunctionAndParams> v_pair in FunctionsToCallOverTime) { if (v_pair != null && v_pair.Value != null) { v_pair.Key -= (float)v_seconds; if (v_pair.Key <= 0) { v_pair.Value.CallFunction(); v_pair.Value = null; v_needClean = true; } } else { v_needClean = true; } } if (v_needClean) { FunctionsToCallOverTime.RemoveNulls(); FunctionsToCallOverTime.RemovePairsWithNullValues(); } #if UNITY_EDITOR if (FunctionsToCallOverTime == null || FunctionsToCallOverTime.Count == 0) { EditorApplication.update -= EditorUpdate; } #endif }