mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-01 11:15:33 +00:00
40 lines
No EOL
903 B
C#
40 lines
No EOL
903 B
C#
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();
|
|
}
|
|
} |