ientityrepository
IEntityRepository
This service maintains the collection of currently registered Entities and provides efficient lookup access based on their Components and static data IDs.
Entities are indexed by the Component types they contain when they are registered. This allows systems to efficiently retrieve or iterate through Entities containing a specific Component without scanning the complete Entity collection.
Methods
| Method | int GetEntityCount<T>() where T : IComponent |
|---|---|
| Description | Returns the number of currently registered Entities containing a Component of type T. Returns zero if no Entities with that Component type are registered. |
| Method | bool TryGetEntityAt<T>(int index, out IEntity? entity) where T : IComponent |
|---|---|
| Description | Attempts to retrieve the IEntity at specified index from the collection of Entities containing a Component of type T. Returns true and outputs the Entity if the index is valid. Returns false and outputs null if the index is negative, no Entities with that Component type are registered, or the index is outside the collection bounds. |
| Method | IEntity[] GetEntitiesWithComponent<T>() where T : IComponent |
|---|---|
| Description | Returns all currently registered Entities containing a Component of type T. Returns an empty array if no matching Entities are registered. |
| Method | IEntity[] GetEntitiesWithComponent(Type componentType) |
|---|---|
| Description | Returns all currently registered Entities containing a Component of specified Type. Returns an empty array if no matching Entities are registered. |
| Method | IEntity[] GetEntitiesWithStaticDataID(string staticDataID) |
|---|---|
| Description | Returns all currently registered Entities whose static data ID matches specified staticDataID. Returns an empty array if no matching Entities are registered. |
ientityrepository.txt · Last modified: by diviner
