Ejemplo 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);
        }
    }
Ejemplo n.º 2
0
 void destroyall()
 {
     for (int i = 0; i < AllAlienShiparr.Count; ++i)
     {
         for (int j = 0; j < AllAlienShiparr[i].Count; ++j)
         {
             enemy1cs a = AllAlienShiparr[i][j].GetComponent <enemy1cs>();
             enemy2cs b = AllAlienShiparr[i][j].GetComponent <enemy2cs>();
             enemy3cs c = AllAlienShiparr[i][j].GetComponent <enemy3cs>();
             if (a != null)
             {
                 a.Die();
             }
             if (b != null)
             {
                 b.Die();
             }
             if (c != null)
             {
                 c.Die();
             }
         }
     }
 }