Class TerrainFactory

java.lang.Object
com.csse3200.game.areas.terrain.TerrainFactory

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

    • TerrainFactory

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

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

    • createTerrain

      public TerrainComponent createTerrain(TerrainFactory.TerrainType terrainType)
      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
      Returns:
      Terrain component which renders the terrain
    • createFromTileMap

      public TerrainComponent createFromTileMap(float tileWorldSize, com.badlogic.gdx.maps.tiled.TiledMap tiledMap, com.badlogic.gdx.math.GridPoint2 tilePixelSize)
      Used to generate TerrainComponent within game areas
      Parameters:
      tileWorldSize -
      tiledMap -
      tilePixelSize -
      Returns:
    • createTerrain

      public TerrainComponent createTerrain(TerrainFactory.TerrainType terrainType, com.badlogic.gdx.math.GridPoint2 mapSize)
      Used to generate terrainComponent within a game area. This method is now not apart of the control flow for generating terrains. Should you createFromTileMap() within the game areas
      Parameters:
      terrainType -
      mapSize -
      Returns:
    • createDefaultTiles

      public com.badlogic.gdx.maps.tiled.TiledMap createDefaultTiles(com.badlogic.gdx.math.GridPoint2 tileSize, com.badlogic.gdx.graphics.g2d.TextureRegion base, com.badlogic.gdx.graphics.g2d.TextureRegion variant1, com.badlogic.gdx.graphics.g2d.TextureRegion variant2, com.badlogic.gdx.graphics.g2d.TextureRegion variant3, com.badlogic.gdx.math.GridPoint2 mapSize)
      Used to create/set ordering of background tiles with variants
      Parameters:
      tileSize -
      base -
      variant1 -
      variant2 -
      variant3 -
      mapSize -
      Returns: