mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-12 01:15:54 +00:00
Sound effects
This commit is contained in:
parent
80a13d047d
commit
60ab375572
41 changed files with 504 additions and 15 deletions
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue