/// <summary> /// /// </summary> /// <returns>Seconds on timer</returns> public float StopStopwatch() { if (!isAlreadyRunning || timerCoroutine == null) { Debug.LogWarning("StopStopwatch is called even though there is no timercoroutine and it isn't already running"); } StopTimerCoroutine(); onTimerTicked.Invoke((long)(time * 1000)); return(time); }
/// <summary> /// Event fired at frequency. /// </summary> /// <param name="sender">sender object.</param> /// <param name="e"> event args.</param> private void Timer_Tick(object sender, EventArgs e) { eventCounter++; if (eventCounter == TimeEvents) { eventCounter = 0; elapsedTime++; TimerTickedEvent?.Invoke(this,elapsedTime); } }