Beispiel #1
0
        public void CreateEntities(ArchetypeManager archetypeManager, Archetype *archetype, Entity *entities, int count)
        {
            while (count != 0)
            {
                var chunk = archetypeManager.GetChunkWithEmptySlots(archetype, null);
                int allocatedIndex;
                var allocatedCount = archetypeManager.AllocateIntoChunk(chunk, count, out allocatedIndex);
                AllocateEntities(archetype, chunk, allocatedIndex, allocatedCount, entities);
                ChunkDataUtility.ClearComponents(chunk, allocatedIndex, allocatedCount);

                entities += allocatedCount;
                count    -= allocatedCount;
            }

            IncrementComponentTypeOrderVersion(archetype);
        }