Package com.csse3200.game.areas
Class GameArea
java.lang.Object
com.csse3200.game.areas.GameArea
- All Implemented Interfaces:
com.badlogic.gdx.utils.Disposable
- Direct Known Subclasses:
SpaceGameArea
,TestGameArea
Represents an area in the game, such as a level, indoor area, etc. An area has a terrain and
other entities to spawn on that terrain.
Support for enabling/disabling game areas could be added by making this a Component instead.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract void
create()
Create the game area in the world.protected void
deSpawnEntity
(Entity entity) de-spawn entity at its current positionvoid
dispose()
Dispose of all internal entities in the areaabstract ClimateController
abstract GameMap
getMap()
void
removeEntity
(Entity entity) void
removeLoadableEntities
(com.badlogic.gdx.utils.Array<Entity> entities) Loops through the games npcs and removes them.void
void
setTractor
(Entity tractor) void
spawnEntity
(Entity entity) Spawn entity at its current positionvoid
spawnEntityAt
(Entity entity, com.badlogic.gdx.math.GridPoint2 tilePos, boolean centerX, boolean centerY) Spawn entity on a given tile.
-
Field Details
-
terrain
-
areaEntities
-
-
Constructor Details
-
GameArea
protected GameArea()
-
-
Method Details
-
create
public abstract void create()Create the game area in the world. -
dispose
public void dispose()Dispose of all internal entities in the area- Specified by:
dispose
in interfacecom.badlogic.gdx.utils.Disposable
-
spawnEntity
Spawn entity at its current position- Parameters:
entity
- Entity (not yet registered)
-
deSpawnEntity
de-spawn entity at its current position- Parameters:
entity
- Entity (not yet registered)
-
spawnEntityAt
public void spawnEntityAt(Entity entity, com.badlogic.gdx.math.GridPoint2 tilePos, boolean centerX, boolean centerY) Spawn entity on a given tile. Requires the terrain to be set first.- Parameters:
entity
- Entity (not yet registered)tilePos
- tile position to spawn atcenterX
- true to center entity X on the tile, false to align the bottom left cornercenterY
- true to center entity Y on the tile, false to align the bottom left corner
-
removeEntity
-
removeLoadableEntities
Loops through the games npcs and removes them. Removes all animals, crop tiles, and plants from the game.- Parameters:
entities
- Array of entities currently in game.
-
getPlayer
-
setPlayer
-
getClimateController
-
getTractor
-
setTractor
-
getMap
-
getAreaEntities
-
getLoadableTypes
-