void OnTriggerEnter(Collider other) { if (other.tag == "Femella") { Destroy(other.gameObject); if (turbo) { nFemelles += 10; xml.sumaMonedas(10); } else { nFemelles += valorFemella; xml.sumaMonedas(valorFemella); } Vector3 Position = new Vector3(0, 4, 1); Position = Position + GetComponent <Rigidbody> ().position; Destroy(Instantiate(feedbackfemelles[nivellValorFemella], Position, feedbackfemelles[nivellValorFemella].GetComponent <Transform>().rotation), 0.5f); monedas.text = "" + nFemelles; audioFemella.GetComponent <AudioSource>().Play(); } if (other.tag == "Botiquin") { Destroy(other.gameObject); vida = vida + valorBotiquin; Destroy(Instantiate(feedbackVida, other.transform.position, feedbackFuel.transform.rotation), 4); barravida.curaVida(valorBotiquin); audioBonus.GetComponent <AudioSource>().Play(); } if (other.tag == "Fuel") { Vector3 offset = new Vector3(0.05f, 0.6f, 0.5f); Destroy(other.gameObject); Destroy(Instantiate(feedbackFuel, other.transform.position, feedbackFuel.transform.rotation), 4); fuel = fuel + valorFuel; fuel = barrafuel.GetComponent <BarraFuel>().sumaFuel(valorFuel); audioBonus.GetComponent <AudioSource>().Play(); } if (other.tag == "Turbo" && !turbo) { Destroy(other.gameObject); Time.timeScale = 5; scale = 5; inmortal = true; turbo = true; barreraInmortal.SetActive(true); barreraInmortal.GetComponent <twinker>().stopTwinkle(); flareTurbo.SetActive(true); camera.GetComponent <MotionBlur>().enabled = true; speed = (1.5f + (float)xml.getNivell("Velocitat") * 1.5f) / 5; Invoke("defaultVelocity", 4 * 5); } if (other.tag == "Enemic" && !inmortal) { Vector3 Position = new Vector3(-0.5f, 4, 0.8f); Position = Position + GetComponent <Rigidbody>().position; Quaternion Rotation = Quaternion.identity; Destroy(Instantiate(feedbackEnemic, Position, Rotation), 0.5f); if (other.name == "CucVerd(Clone)" || other.name == "CucLila(Clone)") { enverinat = true; Invoke("curaEnverinament", 10); } var obj = this.transform.parent; obj.GetComponent <Animation>().CrossFade("fbkenem"); int malTot = other.gameObject.GetComponent <enemic>().mal - resistencia; if (malTot < 0) { malTot = 0; } if (nivellFinal) { malTot = 200; } vida = barravida.treuVida(malTot); other.gameObject.GetComponent <enemic>().mal = 0; comprovaVida(); audioOuch.GetComponent <AudioSource>().Play(); } }