Class BuildingFactory
java.lang.Object
com.deco2800.game.entities.factories.BuildingFactory
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 Summary
FieldsModifier and TypeFieldDescriptionstatic final float
Width in tiles of wall connectors and gates - do not change as they are contingent on CORNER_SCALEstatic final float
Width in tiles of a wall pillar entitystatic final float
-
Method Summary
Modifier and TypeMethodDescriptionstatic Entity
Creates entity, adds and configures Barracks componentsstatic Entity
Use this as a base entity for creating buildingsstatic Entity
Creates and returns a blacksmith building entitystatic Entity
static Entity
Creates a connector between wall pillars, oriented to face east/weststatic Entity
Creates a east/west facing gate entity, that allows friendly units to leave and enter the citystatic Entity
Creates a farm building entity to be spawned in the game.static Entity
Creates and returns a library building entitystatic Entity
Creates a connector between wall pillars, oriented to face north/southstatic Entity
Creates a north/south facing gate entity, that allows friendly units to leave and enter the citystatic Entity
Creates a ship entity, a ship shrine is an enemy building that transports enemy entities from sea to the shores of the island.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.static Entity
Creates a titan shrine entity, a titan shrine is an enemy building that spawns titan's.static Entity
Creates entity, adds and configures TownHall componentsstatic 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.static Entity
Creates a wall entity, adds and configures Wall components
-
Field Details
-
CORNER_SCALE
public static final float CORNER_SCALEWidth in tiles of a wall pillar entity- See Also:
-
CONNECTOR_SCALE
public static final float CONNECTOR_SCALEWidth 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
Use this as a base entity for creating buildings- Returns:
- a new Entity with universal building components
-
createTownHall
Creates entity, adds and configures TownHall components- Returns:
- TownHall Entity
-
createBarracks
Creates entity, adds and configures Barracks components- Returns:
- Barracks Entity
-
createFarm
Creates a farm building entity to be spawned in the game.- Returns:
- farm entity
-
createTitanShrine
Creates a titan shrine entity, a titan shrine is an enemy building that spawns titan's.- Returns:
- Titan Shrine Building 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
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
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
Creates a wall entity, adds and configures Wall components- Returns:
- wall Entity
-
createCornerWall
-
createLibrary
Creates and returns a library building entity- Returns:
- library
-
createBlacksmith
Creates and returns a blacksmith building entity- Returns:
- blacksmith entity
-
createNSConnector
Creates a connector between wall pillars, oriented to face north/south- Returns:
- wall connector oriented to face north/south
-
createEWConnector
Creates a connector between wall pillars, oriented to face east/west- Returns:
- wall connector oriented to face east/west
-
createNSGate
Creates a north/south facing gate entity, that allows friendly units to leave and enter the city- Returns:
- North/South Gate 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
-