Example #1
0
        // Use this method for timescale-independent timers.
        // e.g. timers that you want to tick even if the game is paused.
        public string RegisterScaleIndependentTimer(float duration, CountdownScope scope, Action <string> callback, Action <string, float> percentCallback = null)
        {
            CountdownTimer timer = new CountdownTimer(NopactUtility.GenerateId(), duration, scope, false, callback, percentCallback);

            realTimers.Add(timer);

            return(timer.Id);
        }
Example #2
0
 public CountdownTimer(string id, float duration, CountdownScope scope, bool obsolete, Action <string> callback, Action <string, float> percentCallback)
 {
     this.id              = id;
     this.duration        = duration;
     this.remaining       = duration;
     this.scope           = scope;
     this.obsolete        = obsolete;
     this.callback        = callback;
     this.percentCallback = percentCallback;
 }
Example #3
0
 public PersistentTimer(string id, float duration, CountdownScope scope, bool obsolete, Action <string> callback, Action <string, float> percentCallback, Action <string, float> secondCallback, Action <string> onFaulplayDetection) : base(id, duration, scope, obsolete, callback, percentCallback)
 {
     onFaulplayDetected  = onFaulplayDetection;
     remainingWholeSecs  = Mathf.CeilToInt(duration);
     this.secondCallback = secondCallback;
 }