public static void RemoveBuffEx <T>(this IBuffManager <T> self, IEntity entity, T buff) where T : IBuffDataComponent
        {
            if (self.RemoveBuff(entity, buff))
            {
                _buffPool.Recede(buff);
            }
#if UNITY_EDITOR
            else
            {
                UnityEngine.Debug.LogWarning($"{entity} Remove {buff} Buff failure!");
            }
#endif
        }
示例#2
0
        public void 创建500归还200()
        {
            for (int i = 0; i < 500; i++)
            {
                var testObj = _pool.GetObject <testObj>();
                _objs.Add(testObj);
            }

            for (int i = 0; i < 200; i++)
            {
                _pool.Recede(_objs[i]);
            }
            _stop.Stop();
            _endMemory = GC.GetTotalMemory(true);
            Assert.GreaterOrEqual(_pool.GetCacheCount(typeof(testObj)), 300);
            Assert.GreaterOrEqual(_pool.GetCacheQueueCount(typeof(testObj)), 200);
        }