Package dev.prozilla.pine.core.entity
Class EntityManager
java.lang.Object
dev.prozilla.pine.core.ECSManager
dev.prozilla.pine.core.entity.EntityManager
- All Implemented Interfaces:
Lifecycle
Manages entities in the world.
-
Field Summary
Fields inherited from class dev.prozilla.pine.core.ECSManager
world
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Registers an entity.boolean
Checks whether a given entity has been registered.void
destroy()
Destroys all entities.static int
Generates a new unique entity ID.boolean
Checks if there are any entities.void
removeEntity
(Entity entity) Unregisters an entity.Methods inherited from class dev.prozilla.pine.core.ECSManager
getTracker
-
Constructor Details
-
EntityManager
-
-
Method Details
-
destroy
public void destroy()Destroys all entities. -
addEntity
Registers an entity.- Parameters:
entity
- Entity to register- Throws:
IllegalStateException
- If the entity is already registered.
-
removeEntity
Unregisters an entity.- Parameters:
entity
- Entity to unregister.- Throws:
IllegalStateException
- If the entity has not been registered yet.
-
contains
Checks whether a given entity has been registered. -
getEntities
- Returns:
- List of all entities.
-
hasEntities
public boolean hasEntities()Checks if there are any entities. -
generateEntityId
public static int generateEntityId()Generates a new unique entity ID.- Returns:
- Entity ID
-