public override void Generate(Chunk C) { //Perlin Gen float[,] Perlin = new float[20, 20]; PerlinNoise PNoise = new PerlinNoise(16); for (int y = 0; y < 20; y++) { for (int x = 0; x < 20; x++) { Perlin[x, y] = (float)PNoise.Noise((double)(x + C.Position.X * 16 - 2) / 10, (double)(y + C.Position.Y * 16 - 2) / 10, 0); } } if (C.Position.Y >= -1) { GenerateCaves(C, Perlin); } }
public override void Generate(Chunk C) { //Perlin Gen float[,] Perlin = new float[20, 20]; PerlinNoise PNoise = new PerlinNoise(16); for (int y = 0; y < 20; y++) { for (int x = 0; x < 20; x++) { Perlin[x, y] = (float)PNoise.Noise((double)(x + C.Position.X * 16 - 2) / 10, (double)(y + C.Position.Y * 16 - 2) / 10, 0); } } if (C.Position.Y <= -2) { for (int y = 0; y < 16; y++) { for (int x = 0; x < 16; x++) { C.Blocks[(int)MathHelper.Clamp(x, 0, 15), (int)MathHelper.Clamp(y, 0, 15)] = Block.GetBlock(0); } } } if (C.Position.Y < 0 && C.Position.Y > -2) { GenerateSurface(C, Perlin); GenerateDirtSurface(C, Perlin); GenerateGrassSurface(C, Perlin); } // Background if (C.Position.Y == -1) { C.BackgroundTex = GeneralManager.Textures["Textures/Backgrounds/BackgroundForest"]; } if (C.Position.Y > -1) { C.BackgroundTex = GeneralManager.Textures["Textures/Backgrounds/BackgroundDirt"]; } }