Пример #1
0
 /// <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);
 }
Пример #2
0
        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();
        }
Пример #3
0
 protected override void Awake()
 {
     stoper = new AsyncStoper(this, delay.TimeSpan)
     {
         AutoReset = autoReset
     };
     stoper.OnEnd += (s, e) => onTimeOver.Invoke();
     if (activeOnStart)
     {
         stoper.Start();
     }
 }
Пример #4
0
 protected override void PointerGuiClick(BaseEventData data)
 {
     if (Input.GetMouseButtonUp(0) == false)
     {
         return;
     }
     if (firstClick == true)
     {
         onDoubleClick.Invoke();
     }
     else
     {
         stoper.Start();
         firstClick = true;
     }
 }
Пример #5
0
 public void Run()
 {
     stoper.Start();
 }