public void UpdatePathing() { if (!ElevationManager.ValidTileForElevation(cell)) { return; } UpdatePathfinderCost(); UpdateBlockers(); }
public void UpdateMesh(bool forced = false) { if (!ElevationManager.ValidTileForElevation(cell)) { return; } if (mesh != null) { mesh.UpdateMesh(forced); } else { mesh = CellElevationMesh.Make(cell).GetComponent <CellElevationMesh>(); mesh.UpdateMesh(forced); } }
public static void DoTerrainFeatureEffects() { foreach (TerrainFeature feature in placedFeatures) { foreach (Cell cell in feature.affected) { if (ElevationManager.ValidTileForElevation(cell)) { CellMark mark = ElevationManager.GetCellMark(cell); if (mark != null) { mark.elevationTier = feature.Get(cell); } } } } }
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"); }
public static void TryPlaceTerrainFeatures() { foreach (TerrainFeature terrainFeature in TerrainFeatures) { for (int landmass = 0; landmass < World.inst.NumLandMasses; landmass++) { for (int place = 0; place < featurePlaceTriesPerLandmass; place++) { Cell rand = World.inst.cellsToLandmass[landmass].data[SRand.Range(0, World.inst.cellsToLandmass[landmass].Count)]; if (!ElevationManager.ValidTileForElevation(rand)) { return; } if (terrainFeature.TestPlacement(rand)) { placedFeatures.Add(terrainFeature.Create(rand)); } } } } }