using UnityEngine;

public class ShooterExpload : MonoBehaviour
{
    public delegate void ShooterDestroyedHandler();
    public event ShooterDestroyedHandler onShooterDestroyed;

    private void OnCollisionEnter2D(Collision2D collision)
    {
        // When the shooter is hit by an object with the "bubble" tag
        if (collision.gameObject.CompareTag("bubble"))
        {
            // Destroy the shooter object
            Destroy(gameObject);

            // Invoke the event to notify the spawner that the shooter was destroyed
            onShooterDestroyed?.Invoke();
        }
    }
}
