//detecta cuando entraste al arma del piso public void OnTriggerEnter2D(Collider2D c) { entro = true; tag = c; if (!dash && !dash2) { if (c.gameObject.tag == "BulletsEnemy") { hp = hp - 1; if (hp <= 0) { gameObject.GetComponent <Animator>().SetBool("muerte", true); StartCoroutine(Tiempo(1.7f)); Gun.gameObject.SetActive(false); rb2d.velocity = Vector2.zero; move.CambioMuerto(); } Instantiate(SonidoPlayer[3], shotpos.transform.position, Quaternion.identity); vida.CambioVida(hp); } if (c.gameObject.tag == "Explocion") { hp = hp - 3; if (hp <= 0) { gameObject.GetComponent <Animator>().SetBool("muerte", true); StartCoroutine(Tiempo(2.3f)); Gun.gameObject.SetActive(false); rb2d.velocity = Vector2.zero; move.CambioMuerto(); } Instantiate(SonidoPlayer[3], shotpos.transform.position, Quaternion.identity); vida.CambioVida(hp); } } //item de vida full if (c.gameObject.tag == "ItemHealth") { hp = 5; vida.CambioVida(hp); Instantiate(SonidoItems[1], transform.position, Quaternion.identity); Destroy(tag.gameObject); } //item de vida +1 if (c.gameObject.tag == "ItemHealth1") { if (hp >= 5) { hp = 5; } else { hp = hp + 1; } Instantiate(SonidoItems[0], transform.position, Quaternion.identity); vida.CambioVida(hp); Destroy(tag.gameObject); } //tornillo que da puntos if (c.gameObject.tag == "Tornillo") { Instantiate(SonidoItems[2], transform.position, Quaternion.identity); gameControler.SumarPuntos(150); Destroy(tag.gameObject); } }