void DetermineTerrain(Vector3 biomePos) { // terrain objects have a script that will update themselves based on biome if (terrainToolSelected == terrainTools.erase) // erase { selectedGO = terrainEraser; // terrain ereaser } else { bool isUp = false; if (terrainToolSelected == terrainTools.up) { isUp = true; } else { isUp = false; } Debug.DrawRay(biomePos + new Vector3(0, 0, displacement), Vector3.forward); // check uv sprites RaycastHit hit; if (Physics.Raycast(biomePos + new Vector3(0, 0, displacement), Vector3.forward, out hit)) { selectedGO = tf.BiomeCheck(hit.collider.tag, isUp); // biome check for spawning terrain } else { selectedGO = null; } } ChooseTerrainAudio(); }
// updates terrain object based on biome public void CheckBiome(string biomeTag) { swapObject = tf.BiomeCheck(biomeTag, isUp); if ((swapObject != null) && (!gameObject.name.Contains(swapObject.name))) { SpawnNewTerrian(); } //Debug.DrawRay(uvPos + new Vector3(0, 0, canvasCam.position.z), Vector3.forward); //// check uv sprites //var startPos = uvPos; //startPos.z += canvasCam.position.z; //var raycasts = Physics.RaycastAll(startPos, Vector3.forward); //foreach(var hit in raycasts) //{ // print("Hit by:" + hit.collider.name); // if (!hit.collider.CompareTag("Terrain") && !hit.collider.CompareTag("Planet")) // { // print("GameObject-" + gameObject.name + "'s hit tag: " + hit.collider.tag); // swapObject = tf.BiomeCheck(biomeTag, isUp); // print("swapObject-" + swapObject.name + "'s hit tag: " + hit.collider.tag); // if ((swapObject != null) && (!gameObject.name.Contains(swapObject.name))) // { // SpawnNewTerrian(); // break; // } // } //} //swapObject = tf.BiomeCheck(biomeTag, isUp); }