private void OnBecameInvisible() { if (first) { return; } over = true; GoupCtrl.GameOver(); }
private void OnCollisionEnter2D(Collision2D collision) { dir = (collision.gameObject.tag == "1" ? 1 : -1); if (first) { first = false; return; } if (rigid.transform.position.y <= collision.transform.position.y + 0.5f) { over = true; GoupCtrl.GameOver(); } else { GoupCtrl.AddScore(); } }