//when a well is selected, deselect the lastly selected one and any selected collection, show the audio's box public void selectWell(int wellID) { //deselects previous well if (selectedWellID != -1) { getWellByID(selectedWellID).GetComponent <WellController>().deselect(); } //deselects collection if any is selected int selectedCollectionID = GameObject.Find("CollectionsContainer").GetComponent <CollectionsContainerBehaviour>().getSelectedCollectionID(); if (selectedCollectionID != -1) { GameObject.Find("CollectionsContainer").GetComponent <CollectionsContainerBehaviour>().getCollectionByID(selectedCollectionID).gameObject.GetComponent <SphereCollectionBehaviour>().deselect(); } //select new well, clear old audio box and generate new audio spheres, change selected well material Camera.main.transform.GetChild(0).gameObject.SetActive(true); selectedWellID = wellID; getWellByID(selectedWellID).GetComponent <MeshRenderer>().material = Resources.Load <Material>("red material"); List <AudioClip> audios = getWellByID(wellID).GetComponent <WellController>().getAudios(); AudioboxController box = Camera.main.transform.GetChild(0).GetComponent <AudioboxController>(); box.clearBox(); for (int i = audios.Count - 1; i > -1; i--) { box.createAudioSphere(i, audios[i]); } }
//when a well is selected, deselect the lastly selected one and any selected collection, show the audio's box public void selectWell(int wellID) { //deselects previous well if (selectedWellID != -1 && selectedWellID != wellID) { getWellByID(selectedWellID).GetComponent <WellController>().deselect(); } //deselects collection if any is selected int selectedCollectionID = GameObject.Find("CollectionsContainer").GetComponent <CollectionsContainerBehaviour>().getSelectedCollectionID(); if (selectedCollectionID != -1) { GameObject.Find("CollectionsContainer").GetComponent <CollectionsContainerBehaviour>().getCollectionByID(selectedCollectionID).gameObject.GetComponent <SphereCollectionBehaviour>().deselect(); } //select new well, clear old audio box and generate new audio spheres, change selected well material selectedWellID = wellID; getWellByID(selectedWellID).GetComponent <MeshRenderer>().material.color = selectionColor; List <AudioClip> audios = getWellByID(wellID).GetComponent <WellController>().getAudios(); AudioboxController box = audiobox.GetComponent <AudioboxController>(); box.clearBox(); for (int i = audios.Count - 1; i > -1; i--) { box.createAudioSphere(i, audios[i]); } }