internal IEnumerable <ComponentBufferBase> MatchersFromFlagsSlow(EntityData entityData) //todo rem ienumerable { for (var i = 0; i < SparseCount; i++) { ComponentBufferBase buffer = sparseBuffers_[i]; if (buffer.Matcher.Matches(entityData.FlagsSparse)) { yield return(buffer); } } for (var i = 0; i < DenseCount; i++) { ComponentBufferBase buffer = denseBuffers_[i]; if (buffer.Matcher.Matches(entityData.FlagsDense)) { yield return(buffer); } } }
public TypedComponentBufferBase <T> GetBufferSlow <T>() where T : struct //TODO use a dict of comp types? { for (var i = 0; i < SparseCount; i++) { ComponentBufferBase buffer = sparseBuffers_[i]; if (buffer is ComponentBufferSparse <T> castBuffer) { return(castBuffer); } } for (var i = 0; i < DenseCount; i++) { ComponentBufferBase buffer = denseBuffers_[i]; if (buffer is ComponentBufferDense <T> castBuffer) { return(castBuffer); } } throw new ArgumentOutOfRangeException($"{typeof(T).Name} buffer not found! Did you forget to register it?"); }