private void Update() { RemainingDuration -= Time.deltaTime; if (RemainingDuration <= 0f) { RemainingDuration = 0f; OnTimeElapsed.Invoke(); gameObject.SetActive(false); } }
// 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); } } }
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(); } }
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); }