using Godot;

namespace Cirno.Scripts.Interactables;

public partial class HitButton : Switch
{
    public override void _Ready()
    {
        base._Ready();
        this.AreaEntered += OnAreaEntered;
    }

    private void OnAreaEntered(Area2D area)
    {
        if (area is not Bullet bullet) return;
        if (!bullet.Enabled) return;
        
        this.Activate(this.ActivationType);
        
        bullet.RequestCollisionDestruction();
    }
}