Ejemplo n.º 1
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     Destroy(gameObject);
     AudioSource.PlayClipAtPoint(bombExplodeSound, Camera.main.transform.position, soundVolume);
     if (collision.gameObject != null)
     {
         if (collision.gameObject.tag == "CanDestroy")
         {
             collision.gameObject.SendMessage("AddDestroyPoints");
             gridHandler.DestroyAndCreateEmpty(collision.gameObject.transform);
         }
         else if (collision.gameObject.tag == "Enemy")
         {
             collision.gameObject.SendMessage("AddKillPoints");
             Destroy(collision.gameObject);
         }
         else if (collision.gameObject.tag == "Player")
         {
             Destroy(collision.gameObject);
             canvasHandler.TriggerGameOver(false);
         }
     }
 }