CachedEntityQueryBuilderBase Class
Definition
Namespace: Brine2D.ECS.Query
Abstract base for cached query builders. Holds shared filter state and provides
fluent methods that are identical across all arities. Subclasses only add
Build() with the correct return type.
C#
public abstract class CachedEntityQueryBuilderBase<TSelf>
where TSelf : Brine2D.ECS.Query.CachedEntityQueryBuilderBase<TSelf>
Type parameters
TSelf
Inheritance System.Object → CachedEntityQueryBuilderBase\<TSelf>
Derived
↳ CachedEntityQueryBuilder<T1,T2,T3,T4,T5>
↳ CachedEntityQueryBuilder<T1,T2,T3,T4>
↳ CachedEntityQueryBuilder<T1,T2,T3>
↳ CachedEntityQueryBuilder<T1,T2>
↳ CachedEntityQueryBuilder<T1>
| Methods | |
|---|---|
| IncludeInactive() | Includes both active and inactive entities. |
| OnlyEnabled() | Filters to entities where all required components have IsEnabled set to true. Components are already pre-resolved during cache rebuild, so this check adds negligible overhead. |
| Where\(Func<Entity,bool>\) | Adds a custom filter predicate. |
| WithAllTags\(string\[\]\) | Requires entities to have ALL of the specified tags. |
| WithAnyTag\(string\[\]\) | Requires entities to have AT LEAST ONE of the specified tags. |
| WithBehavior<TBehavior>() | Requires entities to have the specified behavior. The query is automatically invalidated when behaviors are added or removed. |
| WithComponentFilter<TComponent>\(Func<TComponent,bool>\) | Adds a filter that is evaluated on the resolved component value when the cache rebuilds. Unlike Where\(Func<Entity,bool>\), which operates at the entity level, this filter has direct access to the already-resolved component, avoiding an extra pool lookup. |
| WithinBounds\(Rectangle\) | Filters entities whose Position is contained within bounds. |
| WithinRadius\(Vector2, float\) | Filters entities whose Position is within radius of center. |
| Without<TExclude>() | Excludes entities that have the specified component. The query is automatically invalidated when the excluded component type is added to or removed from any entity. |
| WithoutBehavior<TBehavior>() | Excludes entities that have the specified behavior. The query is automatically invalidated when behaviors are added or removed. |
| WithoutTag\(string\) | Requires entities to NOT have the specified tag. |
| WithTag\(string\) | Requires entities to have the specified tag. |