Пример #1
0
        private static void Perform(EntityWorld world, IQueryIterator iterator, EntityQuery query, bool checkVersion, uint version)
        {
            switch (iterator)
            {
            default:
                DevConsole.Log(LogType.Error, "Iterator not found.");
                return;

            case IQueryChunkIterator chunkIterator:
                PerformChunkIteration(world, chunkIterator, query, checkVersion, version);
                return;

            case IQueryEntityIterator entityIterator:
                PerformEntityIteration(world, entityIterator, query, checkVersion, version);
                return;
            }
        }
Пример #2
0
        private static void PerformChunkIteration(EntityWorld world, IQueryChunkIterator chunkIterator, EntityQuery query, bool checkVersion, uint version)
        {
            StructArray <EntityChunk> chunks = world.EntityManager.GetChunks();
            bool generalWrite = query.IsGeneralWrite();

            for (int i = 0; i < chunks.Count; i++)
            {
                ref EntityChunk chunk = ref chunks[i];
                if (query.Matches(chunk.Archetype))
                {
                    if (checkVersion && !chunk.HasChanged(version))
                    {
                        continue;
                    }

                    chunkIterator.Iteration(ref chunk);

                    if (generalWrite || query.NeedsUpdate(ref chunk))
                    {
                        chunk.UpdateVersion(world.EntityManager.Version);
                    }
                }
            }
Пример #3
0
 public static void SetActive(EntityWorld world)
 {
     activeWorld = world;
 }
Пример #4
0
 public static void PerformIteration(EntityWorld world, IQueryIterator iterator, EntityQuery query, uint version) => Perform(world, iterator, query, true, version);
Пример #5
0
 public static void PerformIteration(EntityWorld world, IQueryIterator iterator, EntityQuery query) => Perform(world, iterator, query, false, 0);