void genRivers(int count, int length) { int c = 0; while (c < count) { int x = Random.Range(0, w.size); int y = Random.Range(0, w.size); if (inBounds(new Vector2(x, y), RIVER_SPAWN_BOUNDS)) { continue; } int dir = UnityEngine.Random.Range(0, 5); HexLoc loc = new HexLoc(x, y); for (int i = 0; i < length; i++) { int step = (Random.Range(0, 2) + dir) % 6; while (!w.map.ContainsKey(loc.Neighbor(step))) { step += 1; } w.map[loc].b = Biome.Ocean; loc = loc.Neighbor(step); } genLake(x, y, 2); c++; } //Debug.Log (System.String.Format ("Generated {0} rivers", count)); }