Sound effects

This commit is contained in:
MaddoScientisto 2025-03-01 23:46:25 +01:00
commit 60ab375572
41 changed files with 504 additions and 15 deletions

View file

@ -10,9 +10,19 @@ public partial class Switch : Interactable
[Export] public Array<Node2D> Targets { get; private set; } = new Array<Node2D>();
[Export] public ActivationType ActivationType { get; set; } = ActivationType.Toggle;
private AudioStreamPlayer2D _activationSound;
private readonly string _activationSoundName = "ActivationSound";
public override void _Ready()
{
_activationSound = GetNodeOrNull<AudioStreamPlayer2D>(_activationSoundName);
}
public override bool Activate()
{
if (!MeetsRequirements()) return false;
_activationSound?.Play();
// Compatibility for old single system
bool success = ActivateTarget(Target);