Class TerrainFactory

java.lang.Object
com.csse3200.game.areas.terrain.TerrainFactory
Direct Known Subclasses:
MazeTerrainFactory

public class TerrainFactory extends Object
Factory for creating game terrains.
  • Field Details

    • CHUNK_SIZE

      public static final int CHUNK_SIZE
      See Also:
    • camera

      protected final com.badlogic.gdx.graphics.OrthographicCamera camera
    • orientation

      protected final TerrainOrientation orientation
  • Constructor Details

    • TerrainFactory

      public TerrainFactory(CameraComponent cameraComponent)
      Create a terrain factory with Orthogonal orientation
      Parameters:
      cameraComponent - Camera to render terrains to. Must be orthographic.
    • TerrainFactory

      public TerrainFactory(CameraComponent cameraComponent, TerrainOrientation orientation)
      Create a terrain factory
      Parameters:
      cameraComponent - Camera to render terrains to. Must be orthographic.
      orientation - orientation to render terrain at
  • Method Details

    • getCameraComponent

      public CameraComponent 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 create
      playerPosition - 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)