public void ArrayGen() { List <Vector3> mapBlocks = new List <Vector3>(); mapBlocks = NoiseMap.Create(width, length, height, scale, xPos, zPos, seed); /* Geneartion de la map * Incrémentation de 1 a chaque fois que ca monte * Si le pixel est moins haut que la hauteur alors ajouter un block */ int h = 0; while (h < height) { foreach (Vector3 tile in mapBlocks) { if (tile.y >= h) { blocksString[(int)tile.x, (int)h, (int)tile.z] = "block"; } else { blocksString[(int)tile.x, (int)h, (int)tile.z] = "air"; } } h++; } MapGen(); }
public void SpeedMapGen() { //StartCoroutine("IE_SpeedMapGen"); List <BlocToGen> mapBlocks = new List <BlocToGen>(); mapBlocks = NoiseMap.Create(width, length, scale, xPos, zPos, seed, levels); foreach (BlocToGen tile in mapBlocks) { GameObject cube = Instantiate(Tools.GetMapGenLev(levels, tile.id).model, this.transform); cube.transform.position = this.transform.position + new Vector3(tile.x, 0, tile.z); cube.GetComponent <Block>().Set(tile.x, tile.z, tile.id, this); groundBlocks[(int)tile.x, (int)tile.z] = cube; } }