public void Start() { if (!GetTimers.ContainsKey(this.UniqueName)) GetTimers.Add(this.UniqueName, this); _fCreationTime = (float)Time.time; _fNextIteration = _fCreationTime + Delay; }
public void Stop() { if (GetTimers.ContainsKey(this.UniqueName)) { GetTimers.Remove(this.UniqueName); } }
public static util_timer Create(int reps, float delay, Action func, string uniqueName = "") { if (String.IsNullOrEmpty(uniqueName)) { uniqueName = MxTimer.ToString(); MxTimer++; } var t = new util_timer { Iterations = reps, Delay = delay, Func = func, UniqueName = uniqueName }; // Check if timer already exists if (GetTimers.ContainsKey(uniqueName)) if (GetTimers[uniqueName] != null) t = GetTimers[uniqueName]; t.Start(); return t; }