Package com.csse3200.game.areas.terrain
Class TerrainFactory
java.lang.Object
com.csse3200.game.areas.terrain.TerrainFactory
- Direct Known Subclasses:
MazeTerrainFactory
Factory for creating game terrains.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final com.badlogic.gdx.graphics.OrthographicCamera
static final int
protected final TerrainOrientation
-
Constructor Summary
ConstructorsConstructorDescriptionTerrainFactory
(CameraComponent cameraComponent) Create a terrain factory with Orthogonal orientationTerrainFactory
(CameraComponent cameraComponent, TerrainOrientation orientation) Create a terrain factory -
Method Summary
Modifier and TypeMethodDescriptionprotected com.badlogic.gdx.maps.tiled.TiledMapRenderer
createRenderer
(com.badlogic.gdx.maps.tiled.TiledMap tiledMap, float tileScale) createTerrain
(TerrainFactory.TerrainType terrainType, com.badlogic.gdx.math.GridPoint2 playerPosition, com.badlogic.gdx.math.GridPoint2 mapSize, MapHandler.MapType mapType) Create a terrain of the given type, using the orientation of the factory.Retrieve the component to which the camera is attached
-
Field Details
-
CHUNK_SIZE
public static final int CHUNK_SIZE- See Also:
-
camera
protected final com.badlogic.gdx.graphics.OrthographicCamera camera -
orientation
-
-
Constructor Details
-
TerrainFactory
Create a terrain factory with Orthogonal orientation- Parameters:
cameraComponent
- Camera to render terrains to. Must be orthographic.
-
TerrainFactory
Create a terrain factory- Parameters:
cameraComponent
- Camera to render terrains to. Must be orthographic.orientation
- orientation to render terrain at
-
-
Method Details
-
getCameraComponent
Retrieve the component to which the camera is attached- Returns:
- the camera component
-
createTerrain
public TerrainComponent createTerrain(TerrainFactory.TerrainType terrainType, com.badlogic.gdx.math.GridPoint2 playerPosition, com.badlogic.gdx.math.GridPoint2 mapSize, MapHandler.MapType mapType) Create a terrain of the given type, using the orientation of the factory. This can be extended to add additional game terrains.- Parameters:
terrainType
- Terrain to createplayerPosition
- The current position of the player in the world- Returns:
- Terrain component which renders the terrain
-
createRenderer
protected com.badlogic.gdx.maps.tiled.TiledMapRenderer createRenderer(com.badlogic.gdx.maps.tiled.TiledMap tiledMap, float tileScale)
-