private void HitDetection() { HitDetected = true; OnHitDetected?.Invoke(); HitEffect(); }
private void TryDetectHit(Vector3 position) { var hit = Physics2D.RaycastAll(position, Vector3.forward, _layerToDetect); foreach (var obj in hit) { if (obj.collider.TryGetComponent(out IPoppable bubble)) { OnHitDetected?.Invoke(bubble); } } }