public CooldownController(MonoBehaviour main, TimeSpan time, bool cooldownOnStart = false) { stoper = new AsyncStoper(main, time); if (cooldownOnStart) { Reset(); } }
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 new void Awake() { base.Awake(); stoper = new AsyncStoper(this, TimeSpan.FromSeconds(secondClickDelay), (s, e) => firstClick = false); }
private static void AsyncStoper_OnEnd(object sender, EventArgs e) { AsyncStoper asyncStoper = sender as AsyncStoper; AsyncStoperList.Remove(asyncStoper); }