private void GenerateWorld3() { World world = new World(); //Create chunk bases ChunkBase[,] chunk_b = new ChunkBase[World.RegionSize, World.RegionSize]; ChunkData[,] chunks = new ChunkData[World.RegionSize, World.RegionSize]; River r = new River(); r.SetFirstChunk(new Vec2i(2, 2), 6); r.AddChunk(new Vec2i(3, 2), 6); r.AddChunk(new Vec2i(4, 2), 6); r.AddChunk(new Vec2i(4, 3), 6); r.AddChunk(new Vec2i(5, 3), 6); /* * r.AddChunk(new Vec2i(3,2), 6); * r.AddChunk(new Vec2i(3, 3), 6); * r.AddChunk(new Vec2i(4, 3), 6); * r.AddChunk(new Vec2i(4, 2), 6); * r.AddChunk(new Vec2i(4, 1), 6); * r.AddChunk(new Vec2i(3, 1), 6); * r.AddChunk(new Vec2i(2, 1), 6); * r.AddChunk(new Vec2i(1, 1), 6); */ /* * Vec2i last = new Vec2i(2, 2); * for(int i=0; i<10; i++) * { * int t = (i % 8); * int dx = 0; * int dz = 0; * if (t == 0 || t==1) * dx = 1; * else if (t == 2 || t == 3) * dz = 1; * else if (t == 3 || t == 5) * dx = -1; * else * dz = -1; * //int dx = (i % 2); * //int dz = (i + 1) % 2; * last = last + new Vec2i(dx, dz); * r.AddChunk(last, 6); * }*/ for (int rx = 0; rx < World.RegionSize; rx++) { for (int rz = 0; rz < World.RegionSize; rz++) { chunk_b[rx, rz] = new ChunkBase(new Vec2i(rx, rz), true); } } foreach (KeyValuePair <Vec2i, RiverNode> kvp in r.GenerateRiverNodes()) { chunk_b[kvp.Key.x, kvp.Key.z].AddRiver(kvp.Value); } int[,] emptyLandChunk = new int[World.ChunkSize, World.ChunkSize]; for (int x = 0; x < World.ChunkSize; x++) { for (int z = 0; z < World.ChunkSize; z++) { emptyLandChunk[x, z] = Tile.GRASS.ID; } } for (int rx = 0; rx < World.RegionSize; rx++) { for (int rz = 0; rz < World.RegionSize; rz++) { chunks[rx, rz] = GenerateChunk((int[, ])emptyLandChunk.Clone(), chunk_b[rx, rz]); } } ChunkRegion region = new ChunkRegion(0, 0, chunks); WorldManager.SetWorld(world); WorldManager.LoadedRegions[0, 0] = region; world.SetChunkBases(chunk_b); for (int rx = 0; rx < World.RegionSize - 1; rx++) { for (int rz = 0; rz < World.RegionSize - 1; rz++) { WorldManager.CRManager.LoadChunk(new Vec2i(rx, rz)); } } }