Esempio n. 1
0
    void OnCollisionEnter(Collision collision)
    {
        Collider collider = collision.collider;

        if (collider.CompareTag("Penemy1"))
        {
            enemy1cs e1 = collider.gameObject.GetComponent <enemy1cs>();
            e1.Die();
            Destroy(gameObject);
        }
        if (collider.CompareTag("Penemy2"))
        {
            enemy2cs e2 = collider.gameObject.GetComponent <enemy2cs>();
            e2.Die();
            Destroy(gameObject);
        }
        if (collider.CompareTag("Penemy3"))
        {
            enemy3cs e3 = collider.gameObject.GetComponent <enemy3cs>();
            e3.Die();
            Destroy(gameObject);
        }
        if (collider.CompareTag("bunker"))
        {
            bunker eb = collider.gameObject.GetComponent <bunker>();
            eb.Die();
            Destroy(gameObject);
        }
        if (collider.CompareTag("UFO"))
        {
            UFO uf = collider.gameObject.GetComponent <UFO>();
            uf.Die();
            Destroy(gameObject);
        }
        if (collider.CompareTag("boss"))
        {
            Global gbs = GameObject.FindGameObjectWithTag("FGlobal").GetComponent <Global>();
            boss   bs  = GameObject.FindGameObjectWithTag("boss").GetComponent <boss>();
            AudioSource.PlayClipAtPoint(hitclipboss, bs.transform.position, 10);
            Instantiate(explosion, bs.transform.position, Quaternion.identity);
            gbs.bosslives--;
        }
        if (collider.CompareTag("Fplayer"))
        {
        }
        else
        {
            Destroy(gameObject);
        }
    }
Esempio n. 2
0
    void OnCollisionEnter(Collision collision)
    {
        Collider collider = collision.collider;

        if (collider.CompareTag("Fplayer"))
        {
            player e1 = collider.gameObject.GetComponent <player>();
            e1.Die();
            Destroy(gameObject);
        }
        if (collider.CompareTag("bunker"))
        {
            bunker eb = collider.gameObject.gameObject.GetComponent <bunker>();
            eb.Die();
            Destroy(gameObject);
        }
        else
        {
            Destroy(gameObject);
        }
    }