ArchetypeQuery.md

July 25, 2024 · View on GitHub

Friflo.Engine.ECS

Friflo.Engine.ECS

ArchetypeQuery Class

ArchetypeQuery and all its generic implementations are designed to be reused.
By default, a query does not contain Disabled entities. Use WithDisabled() if needed.
See Example.

public class ArchetypeQuery

Inheritance System.Object 🡒 ArchetypeQuery

Derived
ArchetypeQuery<T1,T2,T3,T4,T5>
ArchetypeQuery<T1,T2,T3,T4>
ArchetypeQuery<T1,T2,T3>
ArchetypeQuery<T1,T2>
ArchetypeQuery<T1>

Fields
FilterReturn component and tag filters added to the query
Properties
ArchetypesReturns the set of Archetype's matching the query.
ChunkCountReturn the number of Chunks returned by the query.
ComponentTypesReturn the ComponentTypes of components returned by a query result.
CountReturn the number of entities matching the query.
EntitiesReturn the ArchetypeQuery entities mainly for debugging.
For efficient access to entity IComponent's use one of the generic EntityStore.Query() methods.
EntityCountObsolete. Renamed to Count.
EventFilterA EventFilter used to filter the query result for added/removed components/tags.
See Example.
StoreThe EntityStore on which the query operates.
Methods
AllComponents(ComponentTypes)A query result will contain only entities having all passed componentTypes.
AllTags(Tags)A query result will contain only entities having all passed tags.
AnyComponents(ComponentTypes)A query result will contain only entities having any of the the passed componentTypes.
AnyTags(Tags)A query result will contain only entities having any of the the passed tags.
FreezeFilter()The query Filter cannot be changed anymore.
HasEvent(int)Returns true if a component or tag was added / removed to / from the entity with the passed entityId.
HasValue<TComponent,TValue>(TValue)Include entities having a component with the specified value.
Executes in O(1).
IsMatch(ComponentTypes, Tags)Returns true if the passed componentTypes and tags matches the query filter.
ToEntityList()Returns the query result as a EntityList used to perform structural changes.
ToString()
ValueInRange<TComponent,TValue>(TValue, TValue)Include entities having a component value in the specified range.
Executes O(N ⋅ log N) N: all unique values.
WithDisabled()A query result will contain Disabled entities.
WithoutAllComponents(ComponentTypes)Entities having all passed componentTypes are excluded from query result.
WithoutAllTags(Tags)Entities having all passed tags are excluded from query result.
WithoutAnyComponents(ComponentTypes)Entities having any of the passed componentTypes are excluded from query result.
WithoutAnyTags(Tags)Entities having any of the passed tags are excluded from query result.