Beispiel #1
0
        // Methods.

        public void Add(float timeDelta, out bool complete)
        {
            timeDelta    = Floats.SetPositive(timeDelta);
            accumulated += timeDelta;
            complete     = (accumulated >= limit);
            if (complete)
            {
                accumulated = Floats.LimitPositive(accumulated - limit, limit);
            }
        }
Beispiel #2
0
        // Constructors.

        public TimeAccumulator(float limit, float accumulated = 0)
        {
            this.limit       = Floats.SetPositive(limit);
            this.accumulated = Floats.LimitPositive(accumulated, this.limit);
        }