Exemple #1
0
        private void Update()
        {
            RemainingDuration -= Time.deltaTime;

            if (RemainingDuration <= 0f)
            {
                RemainingDuration = 0f;
                OnTimeElapsed.Invoke();
                gameObject.SetActive(false);
            }
        }
Exemple #2
0
 // Update is called once per frame
 void Update()
 {
     TimeLeft = TimeLeft.Subtract(TimeSpan.FromSeconds(Time.deltaTime));
     if (TimeLeft.CompareTo(TimeSpan.Zero) <= 0)
     {
         TimeLeft = TimeSpan.Zero;
         enabled  = false;
         if (OnTimeElapsed != null)
         {
             OnTimeElapsed.Invoke(this, null);
         }
     }
 }
Exemple #3
0
        public void Update(GameTime gameTime)
        {
            if (!IsStopped)
            {
                TotalSeconds += gameTime.ElapsedGameTime.TotalSeconds;
            }
            if (!(TotalSeconds >= Interval))
            {
                return;
            }

            OnTimeElapsed?.Invoke(this, new GameTimerEventArgs(TotalSeconds, Interval));
            TotalSeconds = 0;
            if (!IsLooped)
            {
                Reset();
            }
        }
Exemple #4
0
 private void NotificationHandler(object sender, ElapsedEventArgs e)
 {
     OnTimeElapsed?.Invoke(this, e);
 }
        private void ShedulerExecute(object sender, ElapsedEventArgs e)
        {
            Operation operation = (Operation)sender;

            OnTimeElapsed?.Invoke(operation, e);
        }