public static void Initialize() { if (initialized) { return; } initialized = true; components = new ECSCollection <C>(); archtype_components.Add(typeof(C)); create_entity_components += () => components.Add(default);
public static int GetTypeID(Type type) { if (!IDlookups.TryGetValue(type, out var value)) { ComponentTypes.Add(type); IDlookups[type] = value = IDlookups.Count; if (value == component_pools.Length) { Array.Resize(ref entity_pools, value * 2); Array.Resize(ref component_pools, value * 2); } entity_pools[value] = new ECSCollection <Entity>(); var poolType = typeof(Components <>).MakeGenericType(new Type[] { type }); component_pools[value] = (Activator.CreateInstance(poolType) as Components); } return(value); }
public Iterator Init(ECSCollection <T> list) { this.list = list; position = list.count; return(this); }