Ejemplo n.º 1
0
    void OnTriggerEnter(Collider other)
    {
        if (other.CompareTag("MainCamera"))
        {
            player.GetComponent <PlayerHealth>().TakeDamage();
        }
        projectile.GetComponent <TrailRenderer> ().enabled = false;
        projectile.enabled = false;
        sparks.SetActive(true);

        //SOUNDS
        source.clip = explosion;
        source.PlayOneShot(explosion);

        //SCORE
        if (scenetimer != null)
        {
            scenetimer.AddScore();
        }

        if (other.CompareTag("Weapon"))
        {
            manager       = other.transform.GetComponentInParent <WeaponCollisionManager> ();
            manager.timer = 0.5f;
        }

        gameObject.GetComponent <BoxCollider> ().enabled = false;
        Destroy(gameObject, explosion.length);
    }
Ejemplo n.º 2
0
    void OnTriggerEnter(Collider other)
    {
        //VFX
        projectile.enabled = false;
        sparks.SetActive(true);

        //SOUNDS
        source.clip = explosion;
        source.PlayOneShot(explosion);

        //SCORE
        scenetimer.AddScore();

        //DESTROY PROJECTILE
        gameObject.GetComponent <BoxCollider>().enabled = false;
        Destroy(gameObject, explosion.length);
    }