Raymond Maarloeve
Loading...
Searching...
No Matches
BuildingSpawner Class Reference

Responsible for spawning buildings on available map tiles, based on weighted probability and placement rules. More...

Public Member Functions

 BuildingSpawner (Terrain terrain, int tileSize, int mapWidthInTiles, int mapLengthInTiles, int wallsMargin)
 Initializes a new instance of the BuildingSpawner class.
 
List< GameObject > SpawnBuildings (Tile[,] tiles, List< Tile > allTiles, List< BuildingSetup > buildings)
 Attempts to spawn buildings on the map based on tile availability and weighted prefab selection.
 

Detailed Description

Responsible for spawning buildings on available map tiles, based on weighted probability and placement rules.

Constructor & Destructor Documentation

◆ BuildingSpawner()

BuildingSpawner.BuildingSpawner ( Terrain  terrain,
int  tileSize,
int  mapWidthInTiles,
int  mapLengthInTiles,
int  wallsMargin 
)

Initializes a new instance of the BuildingSpawner class.

Parameters
terrainTerrain used for height sampling.
tileSizeSize of a tile in world units.
mapWidthInTilesTotal map width in tiles.
mapLengthInTilesTotal map length in tiles.
wallsMarginMinimum number of tiles to leave empty near the map edge.

Member Function Documentation

◆ SpawnBuildings()

List< GameObject > BuildingSpawner.SpawnBuildings ( Tile  tiles[,],
List< Tile allTiles,
List< BuildingSetup buildings 
)

Attempts to spawn buildings on the map based on tile availability and weighted prefab selection.

Parameters
tiles2D grid of map tiles.
allTilesFlat list of all tiles for randomization.
buildingsList of building prefabs and their configuration.
Returns
List of spawned building GameObjects.

The documentation for this class was generated from the following file: