Rework dimmable audio stream
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
using Chickensoft.AutoInject;
|
||||
using Chickensoft.Introspection;
|
||||
using Godot;
|
||||
using System.Linq;
|
||||
using Zennysoft.Game.Abstractions;
|
||||
using Zennysoft.Ma.Adapter;
|
||||
|
||||
namespace Zennysoft.Game.Ma;
|
||||
@@ -19,6 +21,8 @@ public partial class Overworld : SpecialFloor, IDungeonFloor
|
||||
|
||||
[Node] private Area3D RestoreArea { get; set; } = default!;
|
||||
|
||||
[Node] private Node DimmableAudio { get; set; } = default!;
|
||||
|
||||
private Timer RestoreTimer { get; set; }
|
||||
|
||||
public override void InitializeDungeon()
|
||||
@@ -32,6 +36,17 @@ public partial class Overworld : SpecialFloor, IDungeonFloor
|
||||
RestoreTimer.Timeout += RestoreTimer_Timeout;
|
||||
AddChild(RestoreTimer);
|
||||
FloorIsLoaded = true;
|
||||
|
||||
var dimmableAudio = DimmableAudio.GetChildren().OfType<IDimmableAudioStreamPlayer>();
|
||||
foreach (var dimmable in dimmableAudio)
|
||||
dimmable.FadeIn();
|
||||
}
|
||||
|
||||
public override void FadeOutAudio()
|
||||
{
|
||||
var dimmableAudio = DimmableAudio.GetChildren().OfType<IDimmableAudioStreamPlayer>();
|
||||
foreach (var dimmable in dimmableAudio)
|
||||
dimmable.FadeOut();
|
||||
}
|
||||
|
||||
private void RestoreTimer_Timeout()
|
||||
|
||||
Reference in New Issue
Block a user