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