Audio fade
This commit is contained in:
@@ -2,7 +2,6 @@ using Chickensoft.AutoInject;
|
||||
using Chickensoft.Introspection;
|
||||
using Godot;
|
||||
using System.Linq;
|
||||
using Zennysoft.Game.Abstractions;
|
||||
using Zennysoft.Ma.Adapter;
|
||||
|
||||
namespace Zennysoft.Game.Ma;
|
||||
@@ -22,49 +21,37 @@ public partial class Altar : SpecialFloor, IDungeonFloor
|
||||
|
||||
[Node] private Area3D NoExitArea { get; set; } = default!;
|
||||
|
||||
[Node] private Node DimmableAudio { get; set; } = default!;
|
||||
|
||||
[Export] public Resource Dialogue { get; set; } = default!;
|
||||
|
||||
public void OnResolved()
|
||||
{
|
||||
Show();
|
||||
Exit.AreaEntered += Exit_AreaEntered;
|
||||
NoExitArea.AreaEntered += NoExitArea_AreaEntered;
|
||||
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();
|
||||
Show();
|
||||
Exit.AreaEntered += Exit_AreaEntered;
|
||||
NoExitArea.AreaEntered += NoExitArea_AreaEntered;
|
||||
FloorIsLoaded = true;
|
||||
}
|
||||
|
||||
private void _player_PointUpFinished()
|
||||
{
|
||||
_player.Activate();
|
||||
_player.Activate();
|
||||
}
|
||||
|
||||
private void NoExitArea_AreaEntered(Area3D area)
|
||||
{
|
||||
DialogueController.ShowDialogue(Dialogue, "no_exit");
|
||||
DialogueController.ShowDialogue(Dialogue, "no_exit");
|
||||
}
|
||||
|
||||
private void Exit_AreaEntered(Area3D area)
|
||||
{
|
||||
if (area.GetOwner() is IPlayer)
|
||||
ExitReached();
|
||||
if (area.GetOwner() is IPlayer)
|
||||
ExitReached();
|
||||
}
|
||||
|
||||
public void ExitReached() => Game.FloorExitReached();
|
||||
|
||||
public void OnExitTree()
|
||||
{
|
||||
Exit.AreaEntered -= Exit_AreaEntered;
|
||||
NoExitArea.AreaEntered -= NoExitArea_AreaEntered;
|
||||
Exit.AreaEntered -= Exit_AreaEntered;
|
||||
NoExitArea.AreaEntered -= NoExitArea_AreaEntered;
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -3267,7 +3267,7 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -350.758, -3.90238, 113.556)
|
||||
unique_name_in_owner = true
|
||||
transform = Transform3D(1.51515, 0, 0, 0, 1.51515, 0, 0, 0, 1.51515, 137.047, -0.658938, -5.82563)
|
||||
|
||||
[node name="Interior" type="AudioStreamPlayer3D" parent="Node3D/Audio/DimmableAudio"]
|
||||
[node name="Interior" type="AudioStreamPlayer3D" parent="Node3D/Audio/DimmableAudio" groups=["DimmableAudio"]]
|
||||
process_mode = 3
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 22.4453, 0, 5.97604)
|
||||
stream = ExtResource("2_wbbo3")
|
||||
@@ -3278,7 +3278,7 @@ max_distance = 100.0
|
||||
bus = &"AMBIENT"
|
||||
script = ExtResource("66_q7hpd")
|
||||
|
||||
[node name="Interior2" type="AudioStreamPlayer3D" parent="Node3D/Audio/DimmableAudio"]
|
||||
[node name="Interior2" type="AudioStreamPlayer3D" parent="Node3D/Audio/DimmableAudio" groups=["DimmableAudio"]]
|
||||
process_mode = 3
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -231.692, 6.43338, -92.712)
|
||||
stream = ExtResource("2_wbbo3")
|
||||
@@ -3289,7 +3289,7 @@ max_distance = 54.99
|
||||
bus = &"AMBIENT"
|
||||
script = ExtResource("66_q7hpd")
|
||||
|
||||
[node name="Ocean" type="AudioStreamPlayer3D" parent="Node3D/Audio/DimmableAudio"]
|
||||
[node name="Ocean" type="AudioStreamPlayer3D" parent="Node3D/Audio/DimmableAudio" groups=["DimmableAudio"]]
|
||||
process_mode = 3
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -210.527, -9.55156, -81.5173)
|
||||
stream = ExtResource("3_pvi8n")
|
||||
@@ -3301,7 +3301,7 @@ bus = &"AMBIENT"
|
||||
attenuation_filter_cutoff_hz = 20500.0
|
||||
script = ExtResource("66_q7hpd")
|
||||
|
||||
[node name="Ocean2" type="AudioStreamPlayer3D" parent="Node3D/Audio/DimmableAudio"]
|
||||
[node name="Ocean2" type="AudioStreamPlayer3D" parent="Node3D/Audio/DimmableAudio" groups=["DimmableAudio"]]
|
||||
process_mode = 3
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 109.176, -130.646, -48.6352)
|
||||
stream = ExtResource("3_pvi8n")
|
||||
@@ -3314,7 +3314,7 @@ bus = &"AMBIENT"
|
||||
attenuation_filter_db = -34.0
|
||||
script = ExtResource("66_q7hpd")
|
||||
|
||||
[node name="Ocean3" type="AudioStreamPlayer3D" parent="Node3D/Audio/DimmableAudio"]
|
||||
[node name="Ocean3" type="AudioStreamPlayer3D" parent="Node3D/Audio/DimmableAudio" groups=["DimmableAudio"]]
|
||||
process_mode = 3
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -329.209, -9.13597, -39.3283)
|
||||
stream = ExtResource("3_pvi8n")
|
||||
@@ -3328,7 +3328,7 @@ attenuation_filter_cutoff_hz = 691.0
|
||||
attenuation_filter_db = -34.0
|
||||
script = ExtResource("66_q7hpd")
|
||||
|
||||
[node name="Waterfall" type="AudioStreamPlayer3D" parent="Node3D/Audio/DimmableAudio"]
|
||||
[node name="Waterfall" type="AudioStreamPlayer3D" parent="Node3D/Audio/DimmableAudio" groups=["DimmableAudio"]]
|
||||
process_mode = 3
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -107.057, 0, -48.0532)
|
||||
stream = ExtResource("3_c2gp5")
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=119 format=4 uid="uid://cihbmyo0ltq4m"]
|
||||
[gd_scene load_steps=120 format=4 uid="uid://cihbmyo0ltq4m"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://bfybovehfclqr" path="res://src/map/dungeon/models/Area 1/Exit/A1-Exit_FLOOR1.jpg" id="2_m7ked"]
|
||||
[ext_resource type="Script" uid="uid://bd824eigybu51" path="res://src/map/dungeon/code/ExitRoom.cs" id="2_umdkt"]
|
||||
@@ -22,6 +22,7 @@
|
||||
[ext_resource type="Texture2D" uid="uid://cu2xk2pn7yki7" path="res://src/map/dungeon/models/Area 1/Exit/A1-Exit_brick3.png" id="16_bastv"]
|
||||
[ext_resource type="Texture2D" uid="uid://pyy25p14q8g5" path="res://src/map/dungeon/models/Area 1/Exit/A1-Exit_COLUM2N.png" id="17_7wx2a"]
|
||||
[ext_resource type="PackedScene" uid="uid://cxwyge2s1yswu" path="res://src/map/Placeables/A1-Socket.tscn" id="18_tgauh"]
|
||||
[ext_resource type="Script" uid="uid://b83kye8yinfxs" path="res://src/audio/AmbientSFXPlayer3D.cs" id="22_23ip1"]
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_tio5r"]
|
||||
resource_name = "Material.024"
|
||||
@@ -1352,7 +1353,7 @@ billboard = 2
|
||||
sprite_frames = SubResource("SpriteFrames_s0p2a")
|
||||
autoplay = "default"
|
||||
|
||||
[node name="FLAME1" type="AudioStreamPlayer3D" parent="VFX/Flame1"]
|
||||
[node name="FLAME1" type="AudioStreamPlayer3D" parent="VFX/Flame1" groups=["DimmableAudio"]]
|
||||
process_mode = 3
|
||||
transform = Transform3D(1.62602, 0, 0, 0, 2.24719, 0, 0, 0, 2.24719, -0.237626, -1.0051, -0.623936)
|
||||
stream = ExtResource("6_54fgm")
|
||||
@@ -1360,6 +1361,7 @@ autoplay = true
|
||||
max_distance = 25.0
|
||||
bus = &"AMBIENT"
|
||||
parameters/looping = true
|
||||
script = ExtResource("22_23ip1")
|
||||
|
||||
[node name="OmniLight3D2" type="OmniLight3D" parent="VFX/Flame1"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.180455, -0.538921, -0.0176468)
|
||||
@@ -1376,7 +1378,7 @@ billboard = 2
|
||||
sprite_frames = SubResource("SpriteFrames_s0p2a")
|
||||
autoplay = "default"
|
||||
|
||||
[node name="FLAME2" type="AudioStreamPlayer3D" parent="VFX/Flame2"]
|
||||
[node name="FLAME2" type="AudioStreamPlayer3D" parent="VFX/Flame2" groups=["DimmableAudio"]]
|
||||
process_mode = 3
|
||||
transform = Transform3D(1.62602, 0, 0, 0, 2.24719, 0, 0, 0, 2.24719, -0.237626, -1.0051, -0.623936)
|
||||
stream = ExtResource("6_54fgm")
|
||||
@@ -1384,6 +1386,7 @@ autoplay = true
|
||||
max_distance = 25.0
|
||||
bus = &"AMBIENT"
|
||||
parameters/looping = true
|
||||
script = ExtResource("22_23ip1")
|
||||
|
||||
[node name="OmniLight3D2" type="OmniLight3D" parent="VFX/Flame2"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.180455, -0.538921, -0.0176468)
|
||||
|
||||
Reference in New Issue
Block a user