Example #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
        }
Example #2
0
        internal static void Initialize(int id, bool isPooled = false, bool isNested = false)
        {
            if (id >= lengthTotal)
            {
                var l = id << 1;
                HelperArray.ResizeInt(ref Generations, l, Framework.Settings.SizeGenerations);
                // Array.Resize(ref Transforms, l);

                entities = (CacheEntity *)UnmanagedMemory.ReAlloc(entities, sizeEntityCache * l);

                for (int i = lengthTotal; i < l; i++)
                {
                    entities[i] = new CacheEntity(5);
                }

                lengthTotal = l;
            }

            entities[id].componentsAmount = 0;

            var ptrCache = &entities[id];

            // ptrCache->age      = age;
            ptrCache->isNested = isNested;
            ptrCache->isPooled = isPooled;
            // todo: need to refactor in future
            // ptrCache->isDirty  = true;
            // ptrCache->isAlive  = true;

            ent e = new ent();

            e.id = id;
            // e.age = age;
            // alive.Add(e);
        }
Example #3
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);
        }
Example #4
0
        internal static void Initialize(int id, byte age, bool isPooled = false, bool isNested = false)
        {
            if (id >= lengthTotal)
            {
                var l = id << 1;
                HelperArray.ResizeInt(ref Generations, l, Framework.Settings.SizeGenerations);
                HelperArray.ResizeInt(ref GenerationsInstant, l, Framework.Settings.SizeGenerations);
                Array.Resize(ref Transforms, l);

                entities = (CacheEntity *)UnmanagedMemory.ReAlloc(entities, sizeEntityCache * l);
        #if !ACTORS_TAGS_0
                Tags = (CacheTags *)UnmanagedMemory.ReAlloc(Tags, sizeBufferTags * l);
        #endif

                for (int i = lengthTotal; i < l; i++)
                {
          #if !ACTORS_TAGS_0
                    Tags[i] = new CacheTags();
          #endif
                    entities[i] = new CacheEntity(5);
                }

                lengthTotal = l;
            }

            entities[id].componentsAmount = 0;

            var ptrCache = &entities[id];
            ptrCache->age      = age;
            ptrCache->isNested = isNested;
            ptrCache->isPooled = isPooled;
            // todo: need to refactor in future
            ptrCache->isDirty = true;
            ptrCache->isAlive = true;

            ent e;
            e.id  = id;
            e.age = age;
            alive.Add(e);
        }