Ejemplo n.º 1
0
    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);
        }
    }
Ejemplo n.º 2
0
    //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");
        }
    }
Ejemplo n.º 3
0
    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");
        }
    }