User Tools

Site Tools


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 IEntity[] GetAllEntities()
Description Returns all currently registered Entities.
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.
Method void RegisterEntity(IEntity entity)
Description Registers specified IEntity with the repository. The Entity is added to the global Entity collection and indexed by its static data ID and every Component type it contains.
Method void UnregisterEntity(IEntity entity)
Description Unregisters specified IEntity from the repository. The Entity is removed from the global Entity collection and from the indexes associated with its static data ID and Component types.
ientityrepository.txt · Last modified: by diviner

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki