EntityStoreBase.md

November 22, 2024 · View on GitHub

Friflo.Engine.ECS

Friflo.Engine.ECS

EntityStoreBase Class

Store the IComponents and ITag for the Entity's of an EntityStore.

public abstract class EntityStoreBase

Inheritance System.Object 🡒 EntityStoreBase

Derived
EntityStore
RawEntityStore

Remarks

EntityStoreBase is separated as a base from EntityStore as is can be used for
different entity store implementations like the RawEntityStore.

Properties
ArchetypeCountReturns the current number of Archetypes managed by the entity store.
ArchetypesArray of Archetype's utilized by the entity store
CapacitySumArchetypesReturn the sum of all Archetype capacities.
CountNumber of all entities stored in the entity store
EntityCountObsolete. Renamed to Count.
JobRunnerInitialize a default ParallelJobRunner used for QueryJob's.
ShrinkRatioThresholdShrink ratio threshold: Sum of all Archetype capacities / EntityStore entity count. Default: 10
If the current ratio is > ShrinkRatioThreshold archetype capacities are shrinked.
UniqueEntitiesReturn all UniqueEntity's in the entity store
Methods
Batch(bool)Returns a CreateEntityBatch used to create entities with components and tags added to the batch.
See Example.
FindArchetype(ComponentTypes, Tags)Return the Archetype storing the specified componentTypes and tags.
GetArchetype(ComponentTypes, Tags)Return the Archetype storing the specified componentTypes and tags.
The Archetype is created if not already present.
GetArchetype(Tags)Return the Archetype storing the specified tags.
The Archetype is created if not already present.
GetUniqueEntity(string)Return the entity with a UniqueEntity component and its uid == uid.
See Example.
Query()Create a reusable ArchetypeQuery for the entity store.
See Example.
Query(QueryFilter)Create a reusable ArchetypeQuery with given query filter.
The filter attached to the query can be modified subsequently.
Query<T1,T2,T3,T4,T5>()Create a reusable ArchetypeQuery for the given component types.
See Example.
Query<T1,T2,T3,T4,T5>(QueryFilter)Create a reusable ArchetypeQuery with given query filter.
The filter attached to the query can be modified subsequently.
Query<T1,T2,T3,T4,T5>(Signature<T1,T2,T3,T4,T5>)Create a reusable ArchetypeQuery for given component signature.
Query<T1,T2,T3,T4>()Create a reusable ArchetypeQuery for the given component types.
See Example.
Query<T1,T2,T3,T4>(QueryFilter)Create a reusable ArchetypeQuery with given query filter.
The filter attached to the query can be modified subsequently.
Query<T1,T2,T3,T4>(Signature<T1,T2,T3,T4>)Create a reusable ArchetypeQuery for given component signature.
Query<T1,T2,T3>()Create a reusable ArchetypeQuery for the given component types.
See Example.
Query<T1,T2,T3>(QueryFilter)Create a reusable ArchetypeQuery with given query filter.
The filter attached to the query can be modified subsequently.
Query<T1,T2,T3>(Signature<T1,T2,T3>)Create a reusable ArchetypeQuery for given component signature.
Query<T1,T2>()Create a reusable ArchetypeQuery for the given component types.
See Example.
Query<T1,T2>(QueryFilter)Create a reusable ArchetypeQuery with given query filter.
The filter attached to the query can be modified subsequently.
Query<T1,T2>(Signature<T1,T2>)Create a reusable ArchetypeQuery for given component signature.
Query<T1>()Create a reusable ArchetypeQuery for the given component type.
See Example.
Query<T1>(QueryFilter)Create a reusable ArchetypeQuery with given query filter.
The filter attached to the query can be modified subsequently.
Query<T1>(Signature<T1>)Create a reusable ArchetypeQuery for given component signature.
QueryRelation<T1>()Create a reusable ArchetypeQuery for the given relation type.
QueryRelation<T1>(QueryFilter)Create a reusable ArchetypeQuery with given query filter.
The filter attached to the query can be modified subsequently.
ToString()
UpdateEntityCompIndex(int, int)
Events
OnComponentAddedAdd / remove an event handler for ComponentChanged events triggered by:
AddComponent<T>().
OnComponentRemovedAdd / remove an event handler for ComponentChanged events triggered by:
RemoveComponent<T>().
OnTagsChangedAdd / remove an event handler for TagsChanged events triggered by:
AddTag<TTag>()
AddTags(Tags)
RemoveTag<TTag>()
RemoveTags(Tags).