private void AccumulateFlow(float[] flow, List <int>[] riverPaths, int index) { Tile tile = Find.WorldGrid[index]; flow[index] += tile.rainfall; if (riverPaths[index] != null) { for (int i = 0; i < riverPaths[index].Count; i++) { this.AccumulateFlow(flow, riverPaths, riverPaths[index][i]); flow[index] += flow[riverPaths[index][i]]; } } flow[index] = Mathf.Max(0f, flow[index] - WorldGenStep_Rivers.CalculateTotalEvaporation(flow[index], tile.temperature)); }
private void GenerateRivers() { Find.WorldPathGrid.RecalculateAllPerceivedPathCosts(); List <int> coastalWaterTiles = this.GetCoastalWaterTiles(); if (!coastalWaterTiles.Any <int>()) { return; } List <int> neighbors = new List <int>(); List <int>[] array = Find.WorldPathFinder.FloodPathsWithCostForTree(coastalWaterTiles, delegate(int st, int ed) { Tile tile = Find.WorldGrid[ed]; Tile tile2 = Find.WorldGrid[st]; Find.WorldGrid.GetTileNeighbors(ed, neighbors); int num = neighbors[0]; for (int j = 0; j < neighbors.Count; j++) { if (WorldGenStep_Rivers.GetImpliedElevation(Find.WorldGrid[neighbors[j]]) < WorldGenStep_Rivers.GetImpliedElevation(Find.WorldGrid[num])) { num = neighbors[j]; } } float num2 = 1f; if (num != st) { num2 = 2f; } return(Mathf.RoundToInt(num2 * WorldGenStep_Rivers.ElevationChangeCost.Evaluate(WorldGenStep_Rivers.GetImpliedElevation(tile2) - WorldGenStep_Rivers.GetImpliedElevation(tile)))); }, (int tid) => Find.WorldGrid[tid].WaterCovered, null); float[] flow = new float[array.Length]; for (int i = 0; i < coastalWaterTiles.Count; i++) { this.AccumulateFlow(flow, array, coastalWaterTiles[i]); this.CreateRivers(flow, array, coastalWaterTiles[i]); } }
internal int <> m__0(int st, int ed) { Tile tile = Find.WorldGrid[ed]; Tile tile2 = Find.WorldGrid[st]; Find.WorldGrid.GetTileNeighbors(ed, this.neighbors); int num = this.neighbors[0]; for (int i = 0; i < this.neighbors.Count; i++) { if (WorldGenStep_Rivers.GetImpliedElevation(Find.WorldGrid[this.neighbors[i]]) < WorldGenStep_Rivers.GetImpliedElevation(Find.WorldGrid[num])) { num = this.neighbors[i]; } } float num2 = 1f; if (num != st) { num2 = 2f; } return(Mathf.RoundToInt(num2 * WorldGenStep_Rivers.ElevationChangeCost.Evaluate(WorldGenStep_Rivers.GetImpliedElevation(tile2) - WorldGenStep_Rivers.GetImpliedElevation(tile)))); }
public static float CalculateTotalEvaporation(float flow, float temperature) { return((float)(WorldGenStep_Rivers.CalculateEvaporationConstant(temperature) * WorldGenStep_Rivers.CalculateEvaporativeArea(flow) * 250.0)); }
public static float CalculateEvaporativeArea(float flow) { return(WorldGenStep_Rivers.CalculateRiverSurfaceArea(flow)); }