예제 #1
0
        void Move(Chunk *srcChunk, ref ArchetypeChunkFilter archetypeChunkFilter)
        {
            if (archetypeChunkFilter.Archetype->SystemStateCleanupComplete)
            {
                ChunkDataUtility.Deallocate(srcChunk);
                return;
            }

            var srcArchetype = srcChunk->Archetype;

            if (ChunkDataUtility.AreLayoutCompatible(srcArchetype, archetypeChunkFilter.Archetype))
            {
                fixed(int *sharedComponentValues = archetypeChunkFilter.SharedComponentValues)
                {
                    ChunkDataUtility.ChangeArchetypeInPlace(srcChunk, archetypeChunkFilter.Archetype, sharedComponentValues);
                }

                return;
            }

            var entityBatch = new EntityBatchInChunk {
                Chunk = srcChunk, Count = srcChunk->Count, StartIndex = 0
            };

            Move(entityBatch, ref archetypeChunkFilter);
        }
예제 #2
0
        void Move(Chunk *srcChunk, ref ArchetypeChunkFilter archetypeChunkFilter)
        {
            if (archetypeChunkFilter.Archetype->SystemStateCleanupComplete)
            {
                DeleteChunk(srcChunk);
                return;
            }

            var srcArchetype = srcChunk->Archetype;

            if (ChunkDataUtility.AreLayoutCompatible(srcArchetype, archetypeChunkFilter.Archetype))
            {
                ChangeArchetypeInPlace(srcChunk, ref archetypeChunkFilter);
                return;
            }

            var entityBatch = new EntityBatchInChunk {
                Chunk = srcChunk, Count = srcChunk->Count, StartIndex = 0
            };

            Move(entityBatch, ref archetypeChunkFilter);
        }