public void StartTimer() { _timer.Stop(); Elapsed = TimeSpan.Zero; OnTimerChanged?.Invoke(); _timer.Start(); }
public void Tick(float deltaTime) { if (_counter > 0) { _counter -= deltaTime; OnTimerChanged?.Invoke(_counter); } }
public virtual void UpdateTimer(float timer) { OnTimerChangedEventArgs args = new OnTimerChangedEventArgs() { NewTime = timer }; OnTimerChanged.Invoke(this, args); }
private void OnTimerOnElapsed(object o, ElapsedEventArgs e) { if (_isPaused) { return; } Elapsed += TimeSpan.FromSeconds(1); OnTimerChanged?.Invoke(); }
/// <returns>Is attempt of fire successfull</returns> public bool TryFire() { if (!IsReloaded) { return(false); } _rocketsFactory.CreateRocket(RocketType, _transform.position, _transform.forward); _counter = _reloadingTime; OnTimerChanged?.Invoke(_counter); return(true); }
void IOnUpdate.Do(float deltaTime) { if (!isGameStarted || isTimeStoped) { return; } DayTimeLeft -= deltaTime; foreach (var it in OnTimerChanged.Enumerate()) { it.Do(); } if (DayTimeLeft <= 0) { EndDay(); } }
public static void TimerUpdated(object sender, ChangeEventArgs e) { OnTimerChanged?.Invoke(sender, e); }
public void SetTimer(float seconds) { OnTimerChanged?.Invoke(seconds); }