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

@ -8,6 +8,9 @@ public partial class Door : Activable
protected AnimatedSprite2D _animatedSprite;
protected CollisionShape2D _collisionShape;
protected CollisionShape2D _solidShape;
protected AudioStreamPlayer2D _activationSound;
protected AudioStreamPlayer2D _deactivationSound;
// Called when the node enters the scene tree for the first time.
[Export]
@ -25,6 +28,9 @@ public partial class Door : Activable
_collisionShape = GetNode<CollisionShape2D>("CollisionShape2D");
_solidShape = GetNode<CollisionShape2D>("RigidBody2D/CollisionShape2D");
_activationSound = GetNodeOrNull<AudioStreamPlayer2D>("ActivationSound");
_deactivationSound = GetNodeOrNull<AudioStreamPlayer2D>("DeactivationSound");
SetState(State);
}
@ -38,6 +44,7 @@ public partial class Door : Activable
_animatedSprite.Play("Opening");
State = DoorState.Open;
CallDeferred(MethodName.DeferredDisableCollision, true);
_deactivationSound?.Play();
//_collisionShape.Disabled = true;
//_solidShape.Disabled = true;
}
@ -47,6 +54,7 @@ public partial class Door : Activable
_animatedSprite.Play("Closing");
State = DoorState.Closed;
CallDeferred(MethodName.DeferredDisableCollision, false);
_activationSound?.Play();
//_collisionShape.Disabled = false;
//_solidShape.Disabled = false;
}