/// <summary>
        /// Create a WaitForDuration from a SPTimePeriod as a pooled object.
        ///
        /// NOTE - This retrieves a pooled WaitForDuration that should be used only once. It should be immediately yielded and not used again.
        /// </summary>
        /// <param name="period"></param>
        /// <returns></returns>
        public static WaitForDuration Period(SPTimePeriod period)
        {
            var w = _pool.GetInstance();

            w.Reset((float)period.Seconds, period.TimeSupplier);
            return(w);
        }
        public WaitUntilTime NextInterval(SPTimePeriod interval, float offset)
        {
            var   obj = _pool.GetInstance();
            var   ts  = interval.TimeSupplier ?? SPTime.Normal;
            float t   = MathUtil.FloorToInterval(ts.Total, interval.Seconds, offset) + interval.Seconds;

            obj.Init(t, ts);
            return(obj);
        }
 public WaitUntilTime NextInterval(SPTimePeriod interval, float offset)
 {
     var obj = _pool.GetInstance();
     var ts = interval.TimeSupplier ?? SPTime.Normal;
     float t = MathUtil.FloorToInterval(ts.Total, interval.Seconds, offset) + interval.Seconds;
     obj.Init(t, ts);
     return obj;
 }
Esempio n. 4
0
 public RateOfChange(float units, SPTimePeriod period)
 {
     this.Units      = units;
     this.TimePeriod = period;
 }