public static void Recycle <TComponent>(HashSet <TComponent> list) where TComponent : class, IComponentBase { foreach (var item in list) { PoolRegistries.Recycle(item); } list.Clear(); }
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(); }
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); }
public static void Recycle(StructRegistryBase system) { if (system == null) { return; } var key = system.GetAllTypeBit(); PoolRegistries.Recycle_INTERNAL(key, system); }
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>()); }
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)); }
public static void Recycle <T>(T system, System.Type type) where T : class, IComponentBase { var key = WorldUtilities.GetKey(type); PoolRegistries.Recycle_INTERNAL(key, system); }
public static void Recycle(object system) { var key = WorldUtilities.GetKey(system.GetType()); PoolRegistries.Recycle_INTERNAL(key, system); }
public static void Recycle <T>(ref T system) where T : class, IComponentBase { PoolRegistries.Recycle(system); system = null; }
public static object Spawn(System.Type type) { var key = WorldUtilities.GetKey(type); return(PoolRegistries.Spawn_INTERNAL(key)); }