Rework dimmable audio stream

This commit is contained in:
2026-02-05 14:45:28 -08:00
parent 36b851254e
commit c6fbc9f553
5 changed files with 88 additions and 18 deletions

View File

@@ -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()