Public Member Functions | |
GameWorld (int worldMapWidth, int worldMapHeight) | |
Entity | getEntity (UUID id) throws GameLogicException |
List< Entity > | getEntities () |
void | removeEntity (Entity e) |
void | removeEntity (UUID id) throws GameLogicException |
int | getMapWidth () |
int | getMapHeight () |
void | update () |
Package Functions | |
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, IllegalStateException |
The concrete implementation of the World interface. GameWorld is the sole owner of Entity objects.
Definition at line 24 of file GameWorld.java.
bubolo.world.GameWorld.GameWorld | ( | int | worldMapWidth, |
int | worldMapHeight | ||
) |
Constructs the GameWorld object.
worldMapWidth | the width of the game world map. |
worldMapHeight | the height of the game world map. |
Definition at line 40 of file GameWorld.java.
|
package |
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. |
Implements bubolo.world.World.
Definition at line 71 of file GameWorld.java.
Referenced by bubolo.world.GameWorld.addEntity().
|
package |
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. |
Implements bubolo.world.World.
Definition at line 77 of file GameWorld.java.
References bubolo.world.GameWorld.addEntity().
|
package |
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. |
Implements bubolo.world.World.
Definition at line 83 of file GameWorld.java.
References bubolo.world.GameWorld.addEntity().
|
package |
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. |
Implements bubolo.world.World.
Definition at line 89 of file GameWorld.java.
List<Entity> bubolo.world.GameWorld.getEntities | ( | ) |
Returns the list of all entities in the world. Ordering should not be assumed, and may change between calls.
Implements bubolo.world.World.
Definition at line 64 of file GameWorld.java.
Entity bubolo.world.GameWorld.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. |
Implements bubolo.world.World.
Definition at line 52 of file GameWorld.java.
int bubolo.world.GameWorld.getMapHeight | ( | ) |
Returns the height of the game map.
Implements bubolo.world.World.
Definition at line 138 of file GameWorld.java.
int bubolo.world.GameWorld.getMapWidth | ( | ) |
Returns the width of the game map.
Implements bubolo.world.World.
Definition at line 132 of file GameWorld.java.
void bubolo.world.GameWorld.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. |
Implements bubolo.world.World.
Definition at line 119 of file GameWorld.java.
Referenced by bubolo.world.GameWorld.removeEntity().
void bubolo.world.GameWorld.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. |
Implements bubolo.world.World.
Definition at line 126 of file GameWorld.java.
References bubolo.world.GameWorld.removeEntity().
void bubolo.world.GameWorld.update | ( | ) |
Updates the game world. Must be called once per game tick.
Implements bubolo.world.World.
Definition at line 144 of file GameWorld.java.