mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-04 06:35:54 +00:00
Weapon sounds
This commit is contained in:
parent
22a1ec5ba2
commit
3c531bbe04
14 changed files with 174 additions and 52 deletions
40
Scripts/Weapons/WeaponSoundModule.cs
Normal file
40
Scripts/Weapons/WeaponSoundModule.cs
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
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();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue