Class BuildingFactory

java.lang.Object
com.deco2800.game.entities.factories.BuildingFactory

public class BuildingFactory extends Object
Factory to create a building entity with predefined components.

Each building entity type should have a creation method that returns a corresponding entity.

Predefined buildings properties are loaded from a config stored as a json file and should have the properties stored in 'BuildingConfigs'.

  • Field Details

    • CORNER_SCALE

      public static final float CORNER_SCALE
      Width in tiles of a wall pillar entity
      See Also:
    • CONNECTOR_SCALE

      public static final float CONNECTOR_SCALE
      Width in tiles of wall connectors and gates - do not change as they are contingent on CORNER_SCALE
      See Also:
    • GATE_SCALE

      public static final float GATE_SCALE
      See Also:
  • Method Details

    • createBaseBuilding

      public static Entity createBaseBuilding()
      Use this as a base entity for creating buildings
      Returns:
      a new Entity with universal building components
    • createTownHall

      public static Entity createTownHall()
      Creates entity, adds and configures TownHall components
      Returns:
      TownHall Entity
    • createBarracks

      public static Entity createBarracks()
      Creates entity, adds and configures Barracks components
      Returns:
      Barracks Entity
    • createFarm

      public static Entity createFarm()
      Creates a farm building entity to be spawned in the game.
      Returns:
      farm entity
    • createTitanShrine

      public static Entity createTitanShrine()
      Creates a titan shrine entity, a titan shrine is an enemy building that spawns titan's.
      Returns:
      Titan Shrine Building Entity
    • createShip

      public static Entity createShip()
      Creates a ship entity, a ship shrine is an enemy building that transports enemy entities from sea to the shores of the island. that spawns titan's.
      Returns:
      Ship Building Entity
    • createShip

      public static Entity createShip(AtlantisTerrainFactory terrainFactory)
      Creates a ship entity, a ship shrine is an enemy building that transports enemy entities from sea to the shores of the island. that spawns titan's.
      Returns:
      Ship Building Entity
    • createTrebuchet

      public static Entity createTrebuchet(Entity target, GameArea gameArea)
      Creates a trebuchet entity, a trebuchet is a friendly building that defends the shores of atlantis, it primarily attacks enemy transport ships. that spawns titan's.
      Returns:
      Trebuchet building entity.
    • createWall

      public static Entity createWall()
      Creates a wall entity, adds and configures Wall components
      Returns:
      wall Entity
    • createCornerWall

      public static Entity createCornerWall()
    • createLibrary

      public static Entity createLibrary()
      Creates and returns a library building entity
      Returns:
      library
    • createBlacksmith

      public static Entity createBlacksmith()
      Creates and returns a blacksmith building entity
      Returns:
      blacksmith entity
    • createNSConnector

      public static Entity createNSConnector()
      Creates a connector between wall pillars, oriented to face north/south
      Returns:
      wall connector oriented to face north/south
    • createEWConnector

      public static Entity createEWConnector()
      Creates a connector between wall pillars, oriented to face east/west
      Returns:
      wall connector oriented to face east/west
    • createNSGate

      public static Entity createNSGate()
      Creates a north/south facing gate entity, that allows friendly units to leave and enter the city
      Returns:
      North/South Gate Entity
    • createEWGate

      public static Entity createEWGate()
      Creates a east/west facing gate entity, that allows friendly units to leave and enter the city
      Returns:
      East/West facing Gate Entity