예제 #1
0
파일: Entity.cs 프로젝트: Allexeee/actors
        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
        }
예제 #2
0
파일: Entity.cs 프로젝트: Allexeee/actors
        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);
        }
예제 #3
0
 public MemPool(int length, int elementSize)
 {
     Memory      = (void *)UnmanagedMemory.Alloc(length);
     Length      = length;
     ElementSize = elementSize;
 }
예제 #4
0
 public void Alloc(int length, int elementSize)
 {
     Length      = length;
     ElementSize = elementSize;
     Memory      = (void *)UnmanagedMemory.Alloc(Length * elementSize);
 }