Пример #1
0
        /// <summary>
        /// 释放特定模板对象
        /// </summary>
        /// <param name="name"></param>
        public void ReleaseTemplate(string name)
        {
            if (!IsTemplateExist(name))
            {
                return;
            }

            TemplateCache cache = templateDic[name];

            cache.ReleaseAll();
        }
Пример #2
0
        /// <summary>
        /// 更新,释放模板
        /// </summary>
        public void Update()
        {
            foreach (var templateName in templateDic.Keys)
            {
                TemplateCache cache = templateDic[templateName];

                cache.releaseTimeCount += Time.deltaTime;

                if (cache.releaseTimeCount > cache.releaseTime)
                {
                    cache.ReleaseAll();
                    cache.releaseTimeCount = 0f;
                }
            }
        }