Class EntityManager

java.lang.Object
dev.prozilla.pine.core.ECSManager
dev.prozilla.pine.core.entity.EntityManager
All Implemented Interfaces:
Lifecycle

public class EntityManager extends ECSManager
Manages entities in the world.
  • Constructor Details

    • EntityManager

      public EntityManager(World world)
  • Method Details

    • destroy

      public void destroy()
      Destroys all entities.
    • addEntity

      public void addEntity(Entity entity) throws IllegalStateException
      Registers an entity.
      Parameters:
      entity - Entity to register
      Throws:
      IllegalStateException - If the entity is already registered.
    • removeEntity

      public void removeEntity(Entity entity) throws IllegalStateException
      Unregisters an entity.
      Parameters:
      entity - Entity to unregister.
      Throws:
      IllegalStateException - If the entity has not been registered yet.
    • contains

      public boolean contains(Entity entity)
      Checks whether a given entity has been registered.
    • getEntities

      public List<Entity> 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