Public Member Functions | |
Entity | getEntity (UUID id) throws GameLogicException |
List< Entity > | getEntities () |
public< T extends Entity > T | addEntity (Class< T > c) throws GameLogicException |
public< T extends Entity > T | addEntity (Class< T > c, UUID id) throws GameLogicException |
public< T extends Entity > T | addEntity (Class< T > c, ControllerFactory controllerFactory) throws GameLogicException |
public< T extends Entity > T | addEntity (Class< T > c, UUID id, ControllerFactory controllerFactory) throws GameLogicException |
void | removeEntity (Entity e) |
void | removeEntity (UUID id) throws GameLogicException |
int | getMapWidth () |
int | getMapHeight () |
void | update () |
Provides access to game entities. This is the primary interface between the Model and other systems.
Definition at line 15 of file World.java.
public<T extends Entity> T bubolo.world.World.addEntity | ( | Class< T > | c | ) | throws GameLogicException |
Performs the following actions:
c | the entity's class object. For example, to create a new Tank, call this method using the following form: World.addEntity(Tank.class). |
GameLogicException | if the entity cannot be instantiated, or if the UUID already belongs to an entity. |
Implemented in bubolo.world.GameWorld.
public<T extends Entity> T bubolo.world.World.addEntity | ( | Class< T > | c, |
UUID | id | ||
) | throws GameLogicException |
c | |
c | the entity's class object. For example, to create a new Tank, call this method using the following form: World.addEntity(Tank.class). |
id | the UUID that will be used for the entity. |
GameLogicException | if the entity cannot be instantiated, or if the UUID already belongs to an entity. |
Implemented in bubolo.world.GameWorld.
public<T extends Entity> T bubolo.world.World.addEntity | ( | Class< T > | c, |
ControllerFactory | controllerFactory | ||
) | throws GameLogicException |
c | the entity's class object. For example, to create a new Tank, call this method using the following form: World.addEntity(Tank.class). |
controllerFactory | an object that implements the ControllerFactory interface. This should be used to override the default controller settings. In other words, use a controller factory to set different controller(s) for an entity than the default. |
GameLogicException | if the entity cannot be instantiated, or if the UUID already belongs to an entity. |
Implemented in bubolo.world.GameWorld.
public<T extends Entity> T bubolo.world.World.addEntity | ( | Class< T > | c, |
UUID | id, | ||
ControllerFactory | controllerFactory | ||
) | throws GameLogicException |
c | the entity's class object. For example, to create a new Tank, call this method using the following form: World.addEntity(Tank.class). |
id | the UUID that will be used for the entity. |
controllerFactory | an object that implements the ControllerFactory interface. This should be used to override the default controller settings. In other words, use a controller factory to set different controller(s) for an entity than the default. |
GameLogicException | if the entity cannot be instantiated, or if the UUID already belongs to an entity. |
Implemented in bubolo.world.GameWorld.
List<Entity> bubolo.world.World.getEntities | ( | ) |
Returns the list of all entities in the world. Ordering should not be assumed, and may change between calls.
Implemented in bubolo.world.GameWorld.
Entity bubolo.world.World.getEntity | ( | UUID | id | ) | throws GameLogicException |
Returns an entity from a user id. Throws a GameLogicException if the entity is not found.
id | the entity's unique id. |
GameLogicException | if the entity is not found. |
Implemented in bubolo.world.GameWorld.
int bubolo.world.World.getMapHeight | ( | ) |
Returns the height of the game map.
Implemented in bubolo.world.GameWorld.
int bubolo.world.World.getMapWidth | ( | ) |
Returns the width of the game map.
Implemented in bubolo.world.GameWorld.
void bubolo.world.World.removeEntity | ( | Entity | e | ) |
Removes an entity from the world. After this method is called, the specified entity will no longer be drawn or updated.
e | the entity to remove. |
Implemented in bubolo.world.GameWorld.
void bubolo.world.World.removeEntity | ( | UUID | id | ) | throws GameLogicException |
Removes an entity from the world. After this method is called, the specified entity will no longer be drawn or updated. Throws a GameLogicException if the entity is not found.
id | the unique id of the entity to remove. |
GameLogicException | if the entity is not found. |
Implemented in bubolo.world.GameWorld.
void bubolo.world.World.update | ( | ) |
Updates the game world. Must be called once per game tick.
Implemented in bubolo.world.GameWorld.