public void LoadNamedFile(string fileToLoad) { fileToLoad = inputField.text; terrainArray = XMLVoxelFileReader.LoadChunkFromXMLFile(16, fileToLoad); CreateTerrain(); voxelGenerator.UpdateMesh(); playerScript.EnableControls(); }
void Update() { if (Input.GetKeyDown(KeyCode.Alpha1)) { setBlockTypeToGrass(); } if (Input.GetKeyDown(KeyCode.Alpha2)) { setBlockTypeToDirt(); } if (Input.GetKeyDown(KeyCode.Alpha3)) { setBlockTypeToSand(); } if (Input.GetKeyDown(KeyCode.Alpha4)) { setBlockTypeToStone(); } if (Input.GetKeyDown(KeyCode.Q)) { if (playerScript.controlsEnabled) { playerScript.DisableControls(); } else if (!playerScript.controlsEnabled) { playerScript.EnableControls(); } } if (Input.GetKeyDown(KeyCode.F1)) { terrainArray = XMLVoxelFileReader.LoadChunkFromXMLFile(16, "AssessmentChunk1"); CreateTerrain(); voxelGenerator.UpdateMesh(); } if (Input.GetKeyDown(KeyCode.F2)) { //get terrain array form xml file terrainArray = XMLVoxelFileReader.LoadChunkFromXMLFile(16, "AssessmentChunk2"); //draw correct faces CreateTerrain(); //update mesh info voxelGenerator.UpdateMesh(); } }