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; } }
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); } } }
public static void SetActive(EntityWorld world) { activeWorld = world; }
public static void PerformIteration(EntityWorld world, IQueryIterator iterator, EntityQuery query, uint version) => Perform(world, iterator, query, true, version);
public static void PerformIteration(EntityWorld world, IQueryIterator iterator, EntityQuery query) => Perform(world, iterator, query, false, 0);