public void perform(World world) { string last = "air"; for (float xl = 0; xl < world.xChunks * world.xBlocks; xl++) { for (float yl = 0; yl < world.yChunks * world.yBlocks; yl++) { for (float zl = 0; zl < world.zChunks * world.zBlocks; zl++) { float perlinX = xl / (world.xChunks * world.xBlocks) / perlinCoefX - perlinPlusX, perlinZ = zl / (world.zChunks * world.zBlocks) / perlinCoefZ - perlinPlusZ; float perlinY = Mathf.PerlinNoise(perlinX, perlinZ) * perlinCoefY + perlinPlusY; //Debug.Log(perlinX+" "+perlinZ+" "+perlinY); float x = xl, y = yl / coef * (perlinNoise && !perlinPlus ? perlinY : 1) + (perlinNoise && perlinPlus ? perlinY : 0), z = zl; foreach (GenerationElement gElem in levels) { float xc = gElem.rawX ? xl : x, yc = gElem.rawY ? yl : y, zc = gElem.rawZ ? zl : z; if (Limiter.check(gElem.xMin, xc) && Limiter.check(gElem.xMax, xc) && Limiter.check(gElem.yMin, yc) && Limiter.check(gElem.yMax, yc) && Limiter.check(gElem.zMin, zc) && Limiter.check(gElem.zMax, zc)) { last = gElem.idName; if (gElem.endFor) { break; } } } world.set(new EntityLocation((int)xl, (int)yl, (int)zl, 0, 0, 0, Random.Range(0, 2) > 0, Random.Range(0, 2) > 0, Random.Range(0, 2) > 0), new Entity().recreate(EntityId.ByName(last))); } } } }