void OnTriggerEnter(Collider contacto) { if (contacto.CompareTag("Laser")) { Destroy(gameObject); score.AddScore(scoreValue); Instantiate(muerto, transform.position, transform.rotation); explosion.ActivarAudio("Explosion"); } if (contacto.CompareTag("Bullet")) { Destroy(gameObject); score.AddScore(scoreValue); Instantiate(muerto, transform.position, transform.rotation); explosion.ActivarAudio("Explosion"); } if (contacto.CompareTag("Player")) { Destroy(gameObject); score.AddScore(scoreValue); Instantiate(muerto, transform.position, transform.rotation); explosion.ActivarAudio("Explosion"); } if (contacto.CompareTag("Limite")) { Destroy(gameObject); } }
//Instanciar los proyectiles que seran disparados en modo metralladora void Update() { if (Input.GetButtonDown("Fire1") && Time.time > nextFire && Time.timeScale == 1) { nextFire = Time.time + fireDelta; Rigidbody clone; clone = Instantiate(projectile, transform.position, transform.rotation) as Rigidbody; clone.velocity = transform.TransformDirection(new Vector3(0, 1, 0) * projectileSpeed); audioOn.ActivarAudio("Bullet"); } }
void Update() { if (Input.GetButton("Fire2") && totalAmmo > 0 && Time.time > nextFire && Time.timeScale == 1) { nextFire = Time.time + fireDelta; VerMun(); Rigidbody clone; clone = Instantiate(laser, transform.position, transform.rotation) as Rigidbody; clone.velocity = transform.TransformDirection(new Vector3(0, 1, 0) * projectileSpeed); audioOn.ActivarAudio("Laser"); } }