void Start() { if (PlayerPrefs.GetInt("saveGame") != 1) { //generate world float seed = Random.Range(-1000, 1000); for (int i = -270; i <= 270; i += 9) { for (int j = -270; j <= 270; j += 9) { if (i == -270 || i == -261 || i == 270 || i == 261 || j == -270 || j == 270 || j == -261 || j == 261) { //map borders GameObject insItem = Instantiate(playerInventoryScript.findTerrainPrefabWithName("water"), new Vector3(i, -2f, j), Quaternion.identity); playerInventoryScript.addTerrainToSaves(insItem); } else { float amount = Mathf.PerlinNoise(((float)i + seed) / 70, ((float)j + seed) / 70); if (amount >= 0.84) { GameObject insItem = Instantiate(playerInventoryScript.findTerrainPrefabWithName("rocky"), new Vector3(i, -1.5f, j), Quaternion.identity); playerInventoryScript.addTerrainToSaves(insItem); } else if (amount >= 0.76f) { GameObject insItem = Instantiate(playerInventoryScript.findTerrainPrefabWithName("desert"), new Vector3(i, -1.5f, j), Quaternion.identity); playerInventoryScript.addTerrainToSaves(insItem); } else if (amount >= 0.60f) { GameObject insItem = Instantiate(playerInventoryScript.findTerrainPrefabWithName("savanna"), new Vector3(i, -1.5f, j), Quaternion.identity); playerInventoryScript.addTerrainToSaves(insItem); } else if (amount >= 0.47f) { GameObject insItem = Instantiate(playerInventoryScript.findTerrainPrefabWithName("forest"), new Vector3(i, -1.5f, j), Quaternion.identity); playerInventoryScript.addTerrainToSaves(insItem); } else if (amount >= 0.37f) { GameObject insItem = Instantiate(playerInventoryScript.findTerrainPrefabWithName("plains"), new Vector3(i, -1.5f, j), Quaternion.identity); playerInventoryScript.addTerrainToSaves(insItem); } else { GameObject insItem = Instantiate(playerInventoryScript.findTerrainPrefabWithName("water"), new Vector3(i, -2f, j), Quaternion.identity); playerInventoryScript.addTerrainToSaves(insItem); } } } } } else { //load save SaveAndLoad.LoadPlayer(this); } }