static void Apply() { foreach (CellData data in cellsData.Values) { if (data.valid) { ElevationManager.TrySetElevation(data.cell, Clamp(data.yValue)); } } }
public static void GenerateBase() { Reset(); for (int landmass = 0; landmass < World.inst.NumLandMasses; landmass++) { foreach (Cell cell in World.inst.cellsToLandmass[landmass].data) { CellData data = new CellData { valid = false }; if (cell != null && ElevationManager.ValidTileForElevation(cell)) { try { data.valid = true; data.cell = cell; float yValue = 0f; float noiseValue = Mathf.PerlinNoise(cell.x / scale + generatorSeededState, cell.z / scale + generatorSeededState) * amplitude; float weightage = GetFertilityDistanceWeightage(cell); yValue = noiseValue * weightage * (ElevationManager.maxElevation - ElevationManager.minElevation) + ElevationManager.minElevation; data.yValue = yValue; int y = Clamp(yValue); ElevationManager.TrySetElevation(cell, y); cellsData.Add(cell, data); } catch (Exception ex) { DebugExt.HandleException(ex); } } } } Mod.helper.Log("Base Noise Generated"); }