internal static void Start() { var t = Resources.Load <TextAsset>("SettingsFramework"); if (t != null) { JsonUtility.FromJsonOverwrite(t.text, Framework.Settings); } Framework.Settings.SizeGenerations = Framework.Settings.SizeComponents / 32; lengthTotal = Framework.Settings.SizeEntities; Generations = new int[Framework.Settings.SizeEntities, Framework.Settings.SizeGenerations]; // Transforms = new Transform[Framework.Settings.SizeEntities]; entities = (CacheEntity *)UnmanagedMemory.Alloc(sizeEntityCache * Framework.Settings.SizeEntities); for (int i = 0; i < Framework.Settings.SizeEntities; i++) { entities[i] = new CacheEntity(6); } // alive = new ents(Framework.Settings.SizeEntities); #if UNITY_EDITOR Toolbox.OnDestroyAction += Dispose; #endif }
public static void Clear() { Generations = new int[Framework.Settings.SizeEntities, Framework.Settings.SizeGenerations]; entities = (CacheEntity *)UnmanagedMemory.Alloc(sizeEntityCache * Framework.Settings.SizeEntities); for (int i = 0; i < Framework.Settings.SizeEntities; i++) { entities[i] = new CacheEntity(6); } // alive = new ents(Framework.Settings.SizeEntities); }
public MemPool(int length, int elementSize) { Memory = (void *)UnmanagedMemory.Alloc(length); Length = length; ElementSize = elementSize; }
public void Alloc(int length, int elementSize) { Length = length; ElementSize = elementSize; Memory = (void *)UnmanagedMemory.Alloc(Length * elementSize); }