public bool MoveNext() { var inner = Inner.Span; while (true) { // If the user set Current to default, this mean we need to decrease the index if (current == default) { index--; } if (!canMove && !MoveInnerNext()) { return(false); } var entitySpan = Board.GetEntities(inner[InnerIndex]); if (entitySpan.Length <= index) { canMove = false; continue; } current = new GameEntityHandle(entitySpan[index++]); return(true); } }
public bool MoveNext() { while (Archetypes.Length > index) { var arch = Archetypes[index++]; var span = Board.GetEntities(arch.Id); if (span.Length == 0) { continue; } var matches = 0; var componentSpan = Board.GetComponentTypes(arch.Id); for (var i = 0; i != finalizedQuery.All.Length; i++) { if (componentSpan.Contains(finalizedQuery.All[i].Id)) { matches++; } } if (matches != finalizedQuery.All.Length) { continue; } matches = 0; for (var i = 0; i != finalizedQuery.None.Length && matches == 0; i++) { if (componentSpan.Contains(finalizedQuery.None[i].Id)) { matches++; } } if (matches > 0) { continue; } Current = arch; return(true); } return(false); }