private Dictionary <Vec2i, ChunkStructure> GenerateBanditCampShells(int count = 30) { Dictionary <Vec2i, ChunkStructure> banditShells = new Dictionary <Vec2i, ChunkStructure>(); //iterate all counts for (int i = 0; i < count; i++) { //We make5 attempts to find a valid place for each bandit camp for (int a = 0; a < 5; a++) { //Generate random position and size Vec2i position = GenerationRandom.RandomFromList(GameGenerator.TerrainGenerator.LandChunks); Vec2i size = GenerationRandom.RandomVec2i(2, 6); //Check if position is valid, if (IsPositionValid(position)) { //if valid, we add the structure to ChunkBases and to the dictionary of shells ChunkStructure banditCampShell = new BanditCamp(position, size); for (int x = 0; x < size.x; x++) { for (int z = 0; z < size.z; z++) { GameGenerator.TerrainGenerator.ChunkBases[position.x + x, position.z + z].AddChunkStructure(banditCampShell); } } banditShells.Add(position, banditCampShell); } } } return(banditShells); }
public BanditCampBuilder(BanditCamp shell) { Shell = shell; TileSize = shell.Size * World.ChunkSize; Tiles = new int[TileSize.x, TileSize.z]; Objects = new WorldObjectData[TileSize.x, TileSize.z]; }
private void GenerateBanditCamps(int count) { for (int i = 0; i < count; i++) { GridPoint gp = GetFreeGridPoint(4); if (gp != null) { ChunkStructure cStruct = new BanditCamp(gp.ChunkPos, new Vec2i(2, 2)); ChunkStructures.Add(cStruct); gp.ChunkStructure = cStruct; } } }