private void Action()
 {
     while (!_requestStop)
     {
         OnUpdateTime?.Invoke(this, new TimeEventArgs(DateTime.Now));
         Thread.Sleep(THREAD_PERIODICITY);
     }
 }
Ejemplo n.º 2
0
        protected virtual IEnumerator StartTimer()
        {
            if (!inTimer)
            {
                onInitTimer.Invoke();
                inTimer = true;
                var startTime = Time.time;
                var time      = 0f;
                while (time < timeToExplode)
                {
                    yield return(new WaitForEndOfFrame());

                    time = Time.time - startTime;
                    onUpdateTimer.Invoke(normalizeTime?(time / timeToExplode) :time);
                }
                if (gameObject)
                {
                    onUpdateTimer.Invoke(normalizeTime ? (1f) : timeToExplode);
                    Explode();
                }
            }
        }
Ejemplo n.º 3
0
 public static void UpdateTime(int minutes, int seconds) => OnUpdateTime?.Invoke(minutes, seconds);