public EntityQuery <TEntity> Do <T1>(Action <Entity <TEntity>, T1> process, T1 p1) { IndexPool.Enumerator enumerator = _entitySystem.GetEntityIndexEnumerator(); // If we`re not excluding components ("HasNot") then use simpler bit test case within the loop if (_hasNone == ComponentFlags.None) { while (enumerator.MoveNext()) { int index = enumerator.Current; if (_entitySystem.componentFlags[index].Matches(_hasAll)) { process(_entitySystem.entities[index], p1); } } } else { while (enumerator.MoveNext()) { int index = enumerator.Current; if (_entitySystem.componentFlags[index].Matches(_hasAll, _hasNone)) { process(_entitySystem.entities[index], p1); } } } return(this); }
internal Enumerator(EntityContext <TEntity> entitySystem, ComponentFlags hasAll, ComponentFlags hasNone) { _entitySystem = entitySystem; _entityIndexEnumerator = entitySystem.GetEntityIndexEnumerator(); _current = Entity <TEntity> .None; _hasAll = hasAll; _hasNone = hasNone; }