예제 #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);
            }
        }
예제 #2
0
        // Constructors.

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