Пример #1
0
        public void update()
        {
            float time = Time.time;

            if ((time - last_update_time_) >= update_frequency_)
            {
                last_update_time_ = time;
                if (pool_ != null)
                {
                    int index = UnityEngine.Random.Range(0, pool_.Count);
                    if ((index >= 0) && (index < pool_.Count))
                    {
                        CachedObjectInfo info = pool_[index];
                        if (info == null)
                        {
                            pool_.RemoveAt(index);
                        }
                        else
                        {
                            float num = Time.time - info.get_weight();
                            int   max_shrink_count = (int)(num / worn_time_);
                            if (max_shrink_count > 0)
                            {
                                int free_cache_count = info.get_free_cache_count();
                                if (free_cache_count <= 0)
                                {
                                    pool_.RemoveAt(index);
                                }
                                else
                                {
                                    max_shrink_count = (max_shrink_count <= free_cache_count) ? max_shrink_count : free_cache_count;
                                    info.shrink(max_shrink_count);
                                }
                            }
                        }
                    }
                }
            }
        }