Exemple #1
0
    /// <summary>
    /// Adds a new listener to the timer. It will be notified every GlobalTimerStopwatch.Period after GlobalTimerStopwatch.Offset has occured
    /// </summary>
    /// <param name="listener">The listener to register with the stopwatch</param>
    /// <returns>An integer ID which can be used to remove the listener from the stopwatch in the future</returns>
    public int AddStopwatch(GlobalTimerStopwatch listener)
    {
        int id = stopwatchIds;

        stopwatchIds++;
        StageStopwatchAddition(new TimerData(listener.Offset(), listener.Period(), timer, listener, id));
        return(id);
    }
Exemple #2
0
 public TimerData(float offset, float period, float currentTime, GlobalTimerStopwatch listener, int id)
 {
     this.period   = period;
     this.lastTick = currentTime + offset;
     this.listener = listener;
     this.active   = true;
     this.id       = id;
 }