void OnTriggerEnter2D(Collider2D collision) { if (collision.gameObject.tag == "Border") { switch (collision.gameObject.name) { case "Top": isTouchTop = true; break; case "Bottom": isTouchBottom = true; break; case "Right": isTouchRight = true; break; case "Left": isTouchLeft = true; break; } } else if (collision.gameObject.tag == "Enemy" || collision.gameObject.tag == "Enemy Bullet") { if (isHit) { return; } isHit = true; life--; manager.UpdateLifeIcon(life); if (life == 0) { manager.GameOver(); } else { manager.RespwanPlayer(); } gameObject.SetActive(false); Destroy(collision.gameObject); } }