public void StartTimer() { _timer.Stop(); Elapsed = TimeSpan.Zero; OnTimerChanged?.Invoke(); _timer.Start(); }
// Calledn whenever timer is updated public void UpdateTimer(float time, Transform player) { var thisPlayer = playerData.Where(x => x.player == player).SingleOrDefault(); thisPlayer.time = (int)time; onTimerChangedCallback?.Invoke(thisPlayer.time, player); }
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); }
public static void TimerUpdated(object sender, ChangeEventArgs e) { OnTimerChanged?.Invoke(sender, e); }
public void SetTimer(float seconds) { OnTimerChanged?.Invoke(seconds); }