Пример #1
0
 private void Destroy()
 {
     OnBrickDestroyed?.Invoke(this);
     Destroy(this.gameObject);
 }
Пример #2
0
 private void OnCollisionEnter2D(Collision2D other)
 {
     //Asuming that only ball is moving and it will be the only collider to ever collide with brick.
     OnBrickDestroyed?.Invoke(this);
     gameObject.SetActive(false);
 }