using Godot;

namespace Cirno.Scripts.Weapons;

public partial class WeaponSoundModule : Node2D
{
    [Export]
    public Weapon Weapon { get; private set; }
    
    [Export]
    public AudioStreamPlayer2D ShootSound { get; private set; }
    [Export]
    public AudioStreamPlayer2D ReloadSound { get; private set; }
    [Export]
    public AudioStreamPlayer2D EmptySound { get; private set; }
    
    public override void _Ready()
    {
        if (Weapon?.WeaponData is null) return;

        ShootSound.Stream = Weapon.WeaponData.ShootSound;
        ReloadSound.Stream = Weapon.WeaponData.ReloadSound;
        EmptySound.Stream = Weapon.WeaponData.EmptySound;
    }
    
    public void PlayReloadSound()
    {
        ReloadSound?.Play();
    }

    public void PlayShootSound()
    {
        ShootSound?.Play();
    }

    public void PlayEmptySound()
    {
        EmptySound?.Play();
    }
}