Пример #1
0
 public static void Recycle <TComponent>(HashSet <TComponent> list) where TComponent : class, IComponentBase
 {
     foreach (var item in list)
     {
         PoolRegistries.Recycle(item);
     }
     list.Clear();
 }
Пример #2
0
 public static void Recycle <TComponent>(List <TComponent> list) where TComponent : class, IComponentBase
 {
     for (int i = 0; i < list.Count; ++i)
     {
         PoolRegistries.Recycle(list[i], list[i].GetType());
     }
     list.Clear();
 }
Пример #3
0
 public static void Recycle <TComponent>(ref TComponent[] list) where TComponent : class, IComponentBase
 {
     for (int i = 0; i < list.Length; ++i)
     {
         PoolRegistries.Recycle(list[i]);
     }
     PoolArray <TComponent> .Recycle(ref list);
 }
Пример #4
0
        public static void Recycle(StructRegistryBase system)
        {
            if (system == null)
            {
                return;
            }

            var key = system.GetAllTypeBit();

            PoolRegistries.Recycle_INTERNAL(key, system);
        }
Пример #5
0
        public static T Spawn <T>() where T : class, IComponentBase, new()
        {
            var key = WorldUtilities.GetKey <T>();
            var obj = (T)PoolRegistries.Spawn_INTERNAL(key);

            if (obj != null)
            {
                return(obj);
            }

            return(PoolInternalBase.Create <T>());
        }
Пример #6
0
        public static StructRegistryBase Spawn <T>() where T : struct, IStructComponent
        {
            var key = WorldUtilities.GetAllComponentTypeId <T>();
            var obj = (StructComponents <T>)PoolRegistries.Spawn_INTERNAL(key, out var pool);

            if (obj != null)
            {
                return(obj);
            }

            return(PoolInternalBase.Create <StructComponents <T> >(pool));
        }
Пример #7
0
        public static void Recycle <T>(T system, System.Type type) where T : class, IComponentBase
        {
            var key = WorldUtilities.GetKey(type);

            PoolRegistries.Recycle_INTERNAL(key, system);
        }
Пример #8
0
        public static void Recycle(object system)
        {
            var key = WorldUtilities.GetKey(system.GetType());

            PoolRegistries.Recycle_INTERNAL(key, system);
        }
Пример #9
0
 public static void Recycle <T>(ref T system) where T : class, IComponentBase
 {
     PoolRegistries.Recycle(system);
     system = null;
 }
Пример #10
0
        public static object Spawn(System.Type type)
        {
            var key = WorldUtilities.GetKey(type);

            return(PoolRegistries.Spawn_INTERNAL(key));
        }