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:
- ExtractorMiniGameArea,- MapGameArea,- ShopArea,- SpaceGameArea
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 SummaryFieldsModifier and TypeFieldDescriptionprotected Entityprotected EntityPlacementServiceprotected static Entityprotected StructurePlacementServiceprotected static TerrainComponent
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionabstract voidcreate()Create the game area in the world.voiddispose()Dispose of all internal entities in the areastatic Entityprotected voidplaceEntityAt(Entity entity, com.badlogic.gdx.math.Vector2 position) Function to listen for "placeEntityAt" trigger and repond by placing entitiy at specified position.protected voidFunction to register entity placement service using teh approripate listeners.protected voidprotected voidspawnEntity(Entity entity) Spawn entity at its current positionprotected voidspawnEntityAt(Entity entity, com.badlogic.gdx.math.GridPoint2 tilePos, boolean centerX, boolean centerY) Spawn entity on a given tile.protected voidspawnEntityAtVector(Entity entity, com.badlogic.gdx.math.Vector2 worldPos) protected voidspawnExtractor(Entity entity) Spawn a given extractor at its current position Includes handling the animation of the extractorprotected voidspawnPlayer(com.badlogic.gdx.math.GridPoint2 PLAYER_SPAWN) Spawns the player entity and adds them to the list of targetable entities
- 
Field Details- 
terrain
- 
areaEntities
- 
companion
- 
player
- 
entityPlacementService
- 
structurePlacementService
- 
targetables
 
- 
- 
Constructor Details- 
GameAreapublic GameArea()
 
- 
- 
Method Details- 
createpublic abstract void create()Create the game area in the world.
- 
disposepublic void dispose()Dispose of all internal entities in the area- Specified by:
- disposein interface- com.badlogic.gdx.utils.Disposable
 
- 
getTerrain
- 
getAreaEntities
- 
registerStructurePlacementServiceprotected void registerStructurePlacementService()
- 
spawnExtractorSpawn a given extractor at its current position Includes handling the animation of the extractor- Parameters:
- entity- Entity (not yet registered) representing the extractor
 
- 
registerEntityPlacementServiceprotected void registerEntityPlacementService()Function to register entity placement service using teh approripate listeners. This allows entities to be placed after initilisation.
- 
placeEntityAtFunction to listen for "placeEntityAt" trigger and repond by placing entitiy at specified position.- Parameters:
- entity- - Entity to be placed
- position- - position for where entity should be placed
 
- 
spawnEntitySpawn entity at its current position- Parameters:
- entity- Entity (not yet registered)
 
- 
spawnPlayerprotected void spawnPlayer(com.badlogic.gdx.math.GridPoint2 PLAYER_SPAWN) Spawns the player entity and adds them to the list of targetable entities
- 
spawnEntityAtprotected 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 at
- centerX- true to center entity X on the tile, false to align the bottom left corner
- centerY- true to center entity Y on the tile, false to align the bottom left corner
 
- 
spawnEntityAtVector
- 
getCompanion
- 
getPlayer
 
-