Exemplo n.º 1
0
        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
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
 public MemPool(int length, int elementSize)
 {
     Memory      = (void *)UnmanagedMemory.Alloc(length);
     Length      = length;
     ElementSize = elementSize;
 }
Exemplo n.º 4
0
 public void Alloc(int length, int elementSize)
 {
     Length      = length;
     ElementSize = elementSize;
     Memory      = (void *)UnmanagedMemory.Alloc(Length * elementSize);
 }