Beispiel #1
0
        /// <summary>
        /// Adds the specified item.
        /// </summary>
        /// <param name="item">The item.</param>
        /// <param name="interval">The interval between updates. This overrides the <see cref="defaultUpdateInterval"/>.</param>
        /// <param name="delayFirstUpdateBy">The delay by which the first update of the item will be scheduled.</param>
        public void Add(ILoadBalanced item, float interval, float delayFirstUpdateBy)
        {
            var now       = UnityServices.time.time;
            var queueItem = new LoadBalancerItem
            {
                lastUpdate = now,
                nextUpdate = now + delayFirstUpdateBy,
                interval   = interval,
                item       = item
            };

            _queue.Add(queueItem);
        }
        /// <summary>
        /// Adds the specified item.
        /// </summary>
        /// <param name="item">The item.</param>
        /// <param name="interval">The interval between updates. This overrides the <see cref="defaultUpdateInterval"/>.</param>
        /// <param name="delayFirstUpdateBy">The delay by which the first update of the item will be scheduled.</param>
        public ILoadBalancedHandle Add(ILoadBalanced item, float interval, float delayFirstUpdateBy)
        {
            var now       = _time();
            var queueItem = new LoadBalancerItem
            {
                parent     = this,
                lastUpdate = now,
                nextUpdate = now + delayFirstUpdateBy,
                interval   = interval,
                item       = item
            };

            _queue.Add(queueItem);
            return(queueItem);
        }
 private void Remove(LoadBalancerItem item)
 {
     _queue.Remove(item);
 }