Exemple #1
0
 public static void Recycle <TComponent>(HashSet <TComponent> list) where TComponent : class, IComponentBase
 {
     foreach (var item in list)
     {
         PoolRegistries.Recycle(item);
     }
     list.Clear();
 }
Exemple #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();
 }
Exemple #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);
 }
Exemple #4
0
        public static void Recycle(StructRegistryBase system)
        {
            if (system == null)
            {
                return;
            }

            var key = system.GetAllTypeBit();

            PoolRegistries.Recycle_INTERNAL(key, system);
        }
Exemple #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>());
        }
Exemple #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));
        }
Exemple #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);
        }
Exemple #8
0
        public static void Recycle(object system)
        {
            var key = WorldUtilities.GetKey(system.GetType());

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

            return(PoolRegistries.Spawn_INTERNAL(key));
        }