Creates a new instance of ComponentRepository. Note: This class is designed to be used statically, so instantiation is typically not necessary.
Static
_getInternal
Gets an array of all component instances of the specified type. This is an internal method that includes undefined slots in the array.
The component class to retrieve instances for
Array of component instances with potential undefined elements, or undefined if type not found
Static
_getInternal
Gets an array of all component instances including deleted/dead components. This internal method provides access to the raw component array with undefined slots.
The component class to retrieve instances for
Array of component instances including dead components, or undefined if type not found
Static
createCreates a new component instance for the specified entity. This method handles ComponentSID allocation, including reusing SIDs from deleted components.
The ComponentTID of the component type to create
The EntityUID of the entity that will own this component
Reference to the entity repository for entity management
The newly created component instance
Static
deleteDeletes a component instance from the repository. This marks the component's slot as available for reuse and removes it from the active components.
The component instance to delete
Static
deregisterStatic
getRetrieves a specific component instance by its class and ComponentSID.
The component class to search for
The ComponentSID of the specific component instance
The component instance, or undefined if not found
Static
getStatic
getRetrieves a specific component instance by ComponentTID and ComponentSID.
The ComponentTID of the component type
The ComponentSID of the specific component instance
The component instance, or undefined if not found
Static
getStatic
getRetrieves all active (non-null) component instances of the specified type. This method filters out deleted components and returns only valid instances.
The component class to retrieve instances for
Array of active component instances (never includes undefined elements)
Static
getCalculates the memory begin index for a given component type. This is used for memory layout calculations in the component system.
The ComponentTID to calculate the memory index for
The starting memory index for the component type
Static
getStatic
registerRegisters a component class with the repository. This method associates a component class with its unique ComponentTID for later instantiation.
The component class constructor to register
The repository class that manages all component classes and their instances. This class provides functionality to register component classes, create component instances, and manage the lifecycle of components within the ECS (Entity-Component-System) architecture.