//void OnCollisionEnter(Collision other) void OnTriggerEnter(Collider other) { collider_aux = other; if (other.gameObject.tag == "Player") { gamecontroller_aux.maximo_puntaje_control(); //Control Puntaje maximo //Sonido Encontrado Salida audiocontroller_aux.reproducir("Avanzar_Nivel"); //Apago Jugador y dejo velocidad en cero other.gameObject.SetActive(false); other.gameObject.GetComponent <Rigidbody>().velocity = Vector3.zero; //Desactivo controles y cargo siguiente nivel gamecontroller_aux.controlenevento_desactivar(); gamecontroller_aux.siguiente_nivel(); if (apagaralsalir) { gameObject.SetActive(false); if (crear_salida != null) { Instantiate(crear_salida, transform.position, Quaternion.identity); } } } }
void OnTriggerEnter(Collider other) { if (other.gameObject.tag == "Player") { gamecontroller_aux.sumarpuntos(puntos); if (sonido_reproducir != null && audiocontroller_aux != null) { audiocontroller_aux.reproducir(sonido_reproducir); } Destroy(gameObject); } }
void Start() { audiocontroller_aux = FindObjectOfType <audiocontroller>(); if (sonido_reproducir != null && audiocontroller_aux != null) { audiocontroller_aux.reproducir(sonido_reproducir); } else { Debug.Log("Es nulo sonido para portal"); } }
private IEnumerator Menu() { //Re obtengo el "telon" en cada escena cambiador_fades = FindObjectOfType <changer_fades>(); if (SceneManager.GetActiveScene().name == "Menu") { //Musica MENU audiocontroller_aux.reproducir("Menu_Intro"); //Buscando CANVAS de MENU MenuCanvas_Menu = GameObject.Find("Panel_Principal_Canvas"); max_puntaje = PlayerPrefs.GetString("hiscore", "v"); //Controlo HISCORE if (max_puntaje != "v" && MenuCanvas_Menu != null) { MenuCanvas_Menu.gameObject.transform.GetChild(4).gameObject.SetActive(true); GameObject aux_puntajemaximo = MenuCanvas_Menu.gameObject.transform.GetChild(4).GetChild(1).gameObject; //UI donde defino el puntaje maximo actual aux_puntajemaximo.GetComponent <Text>().text = "" + puntos_encript.decript_publico(max_puntaje); } else { if (max_puntaje == "v" && MenuCanvas_Menu != null) { MenuCanvas_Menu.gameObject.transform.GetChild(4).gameObject.SetActive(false); GameObject aux_puntajemaximo = MenuCanvas_Menu.gameObject.transform.GetChild(4).GetChild(1).gameObject; //UI donde defino el puntaje maximo actual aux_puntajemaximo.GetComponent <Text>().text = ""; } } //Controlo Vidas para Continuar partida string aux_local = PlayerPrefs.GetString("continue_vidas", "z"); if (aux_local != "z") { //MenuCanvas_Menu.gameObject.transform.GetChild(5).gameObject.SetActive(true); MenuCanvas_Menu.gameObject.transform.GetChild(0).GetChild(3).gameObject.SetActive(true); } else { MenuCanvas_Menu.gameObject.transform.GetChild(0).GetChild(3).gameObject.SetActive(false); } } //Mientras estoy en el menu realizar... while (SceneManager.GetActiveScene().name == "Menu") { yield return(null); } StartCoroutine(PartidaInicial()); }
void OnTriggerEnter(Collider other) { //if(other.gameObject.tag == "Player"||other.gameObject.tag == "Enemigo") if (other.gameObject.tag == "Player") { if (para_todo) { audiocontroller_aux.detener_todo(); } else { if (sonido_detener != null && audiocontroller_aux != null) { audiocontroller_aux.detener(sonido_detener); } } if (sonido_reproducir != null && audiocontroller_aux != null) { audiocontroller_aux.reproducir(sonido_reproducir); } if (destruir_obj != null) { Destroy(destruir_obj); } if (crear_obj != null) { Instantiate(crear_obj, transform.position, Quaternion.identity); } if (destruir) { Destroy(gameObject); } } }