public void GenerateTopology(MapRegion region, IRegionTopologyTemplate template) { var landCells = region.LandCells; int desiredMountainCount = Mathf.RoundToInt(template.MountainsPercentage * landCells.Count() * 0.01f); int desiredHillsCount = Mathf.RoundToInt(template.HillsPercentage * landCells.Count() * 0.01f); var elevatedCells = CellRandomSampler.SampleElementsFromSet( landCells, desiredHillsCount + desiredMountainCount, HillsStartingWeightFunction, HillsDynamicWeightFunction, cell => Grid.GetNeighbors(cell) ); foreach (var cell in elevatedCells) { ModLogic.ChangeShapeOfCell(cell, CellShape.Hills); } var mountainousCells = CellRandomSampler.SampleElementsFromSet( elevatedCells, desiredMountainCount, MountainWeightFunction ); foreach (var cell in mountainousCells) { ModLogic.ChangeShapeOfCell(cell, CellShape.Mountains); } }
public RegionData( IRegionBiomeTemplate biome, IRegionTopologyTemplate topology, IEnumerable <IBalanceStrategy> availableBalanceStrategies ) { Biome = biome; Topology = topology; AvailableBalanceStrategies = availableBalanceStrategies; }