/// <summary> /// Cheks if cooldown pass and reset it if it's true. /// </summary> /// <returns></returns> public bool Try() { if (stoper.MaxTime == TimeSpan.Zero) { return(true); } if (stoper.IsStoperRunning == false) { stoper.Start(); return(true); } return(false); }
public static void MakeSimple(MonoBehaviour main, TimeSpan time, EventHandler <EventArgs> @event) { AsyncStoperList.Add(new AsyncStoper(main, time, @event)); AsyncStoper stoper = AsyncStoperList[AsyncStoperList.Count - 1]; stoper.OnEnd += AsyncStoper_OnEnd; stoper.Start(); }
protected override void Awake() { stoper = new AsyncStoper(this, delay.TimeSpan) { AutoReset = autoReset }; stoper.OnEnd += (s, e) => onTimeOver.Invoke(); if (activeOnStart) { stoper.Start(); } }
protected override void PointerGuiClick(BaseEventData data) { if (Input.GetMouseButtonUp(0) == false) { return; } if (firstClick == true) { onDoubleClick.Invoke(); } else { stoper.Start(); firstClick = true; } }
public void Run() { stoper.Start(); }