public void setGUI(Elemento_Script e) { if (e == null) { nome_Composto.GetComponent <UnityEngine.UI.Text>().text = "Nome: "; elem1.GetComponent <UnityEngine.UI.Text>().text = "Composto A: "; elem2.GetComponent <UnityEngine.UI.Text>().text = "Composto B: "; s1.GetComponent <UnityEngine.UI.Text>().text = "S1: "; s2.GetComponent <UnityEngine.UI.Text>().text = "S2: "; s3.GetComponent <UnityEngine.UI.Text>().text = "S3: "; s4.GetComponent <UnityEngine.UI.Text>().text = "S4: "; s5.GetComponent <UnityEngine.UI.Text>().text = "S5: "; s6.GetComponent <UnityEngine.UI.Text>().text = "S6: "; return; } nome_Composto.GetComponent <UnityEngine.UI.Text>().text = "Nome: " + e.nome; elem1.GetComponent <UnityEngine.UI.Text>().text = "Composto A: " + e.elem1; elem2.GetComponent <UnityEngine.UI.Text>().text = "Composto B: " + e.elem2; s1.GetComponent <UnityEngine.UI.Text>().text = "S1: " + e.s1 + " eletrons"; s2.GetComponent <UnityEngine.UI.Text>().text = "S2: " + e.s2 + " eletrons"; s3.GetComponent <UnityEngine.UI.Text>().text = "S3: " + e.s3 + " eletrons"; s4.GetComponent <UnityEngine.UI.Text>().text = "S4: " + e.s4 + " eletrons"; s5.GetComponent <UnityEngine.UI.Text>().text = "S5: " + e.s5 + " eletrons"; s6.GetComponent <UnityEngine.UI.Text>().text = "S6: " + e.s6 + " eletrons"; }
public void set_Elemento(Elemento_Script elemento) { this.elemento = elemento; (nucleo_Inspector.GetComponent(typeof(Nucleo_Script)) as Nucleo_Script).setProtons(elemento.n_atomos_elemA, elemento.n_atomos_elemB, nucleo_Inspector); (camada1_Inspector.GetComponent(typeof(Camada_Script)) as Camada_Script).setEletrons(elemento.s1); (camada2_Inspector.GetComponent(typeof(Camada_Script)) as Camada_Script).setEletrons(elemento.s2); (camada3_Inspector.GetComponent(typeof(Camada_Script)) as Camada_Script).setEletrons(elemento.s3); (camada4_Inspector.GetComponent(typeof(Camada_Script)) as Camada_Script).setEletrons(elemento.s4); (camada5_Inspector.GetComponent(typeof(Camada_Script)) as Camada_Script).setEletrons(elemento.s5); (camada6_Inspector.GetComponent(typeof(Camada_Script)) as Camada_Script).setEletrons(elemento.s6); }
private GameObject elemento_Instancia; //elemento que é mantido no estado atual da execução public void novo_Elemento(Elemento_Script elemento) { if (elemento_Instancia != null) { Destroy(elemento_Instancia); } if (elemento == null) { (canvas.GetComponent(typeof(Canvas_Script)) as Canvas_Script).setGUI(null); return; } elemento_Instancia = Instantiate(elemento_Prefab, Vector3.zero, Quaternion.identity); (elemento_Instancia.GetComponent(typeof(ElementoController_Script)) as ElementoController_Script).set_Elemento(elemento); (canvas.GetComponent(typeof(Canvas_Script)) as Canvas_Script).setGUI(elemento); elemento_Instancia.SetActive(true); }