//ONDE OCORRE AS COLISÕES void OnCollisionEnter2D(Collision2D col) { if (col.gameObject.tag == "Moeda") { moedas++; SomJogador.SomMoeda(); Destroy(col.gameObject); } if (col.gameObject.tag == "Comida") { pontos++; SomJogador.SomPonto(); Destroy(col.gameObject); } if (col.gameObject.tag == "Veneno") { vidas--; SomJogador.SomDano(); Destroy(col.gameObject); StartCoroutine("MudarCor"); } }
///ONDE OCORRE AS COLISISÕES void OnCollisionEnter2D(Collision2D col) { //TOCOU NA COMIDA if (col.gameObject.tag == "comida") { pontos++; SomJogador.SomPonto(); Destroy(col.gameObject); } //TOCOU NO VENENO if (col.gameObject.tag == "veneno") { vida--; SomJogador.SomDano(); Destroy(col.gameObject); } //TOCOU NA MOEDA if (col.gameObject.tag == "moeda") { moedas++; SomJogador.SomMoeda(); Destroy(col.gameObject); } }