Beispiel #1
0
        private void HitDetection()
        {
            HitDetected = true;
            OnHitDetected?.Invoke();

            HitEffect();
        }
Beispiel #2
0
        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);
                }
            }
        }