Функционал кошмаров

This commit is contained in:
Евгений Титаренко 2024-08-25 14:39:39 +03:00
parent 4222af1896
commit a87871a704
5 changed files with 58 additions and 4 deletions

View file

@ -1,4 +1,4 @@
[gd_resource type="AudioBusLayout" load_steps=3 format=3 uid="uid://l2ld5cr1ew0r"]
[gd_resource type="AudioBusLayout" load_steps=5 format=3 uid="uid://l2ld5cr1ew0r"]
[sub_resource type="AudioEffectReverb" id="AudioEffectReverb_728t0"]
resource_name = "Reverb"
@ -8,6 +8,14 @@ room_size = 0.2
resource_name = "Reverb"
room_size = 0.4
[sub_resource type="AudioEffectReverb" id="AudioEffectReverb_y6xta"]
resource_name = "Reverb"
room_size = 0.1
[sub_resource type="AudioEffectStereoEnhance" id="AudioEffectStereoEnhance_2b60j"]
resource_name = "StereoEnhance"
surround = 1.0
[resource]
bus/1/name = &"Music"
bus/1/solo = false
@ -25,3 +33,13 @@ bus/2/volume_db = 0.0
bus/2/send = &"Master"
bus/2/effect/0/effect = SubResource("AudioEffectReverb_wcs3s")
bus/2/effect/0/enabled = true
bus/3/name = &"Nightmare"
bus/3/solo = false
bus/3/mute = false
bus/3/bypass_fx = false
bus/3/volume_db = -10.0741
bus/3/send = &"Master"
bus/3/effect/0/effect = SubResource("AudioEffectReverb_y6xta")
bus/3/effect/0/enabled = true
bus/3/effect/1/effect = SubResource("AudioEffectStereoEnhance_2b60j")
bus/3/effect/1/enabled = true

Binary file not shown.

View file

@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://cw6y35jglsn1"
path="res://.godot/imported/D1nm.wav-c96eab61063b597f9e055d0540dfc4b5.sample"
[deps]
source_file="res://resources/sounds/nightmares/D1nm.wav"
dest_files=["res://.godot/imported/D1nm.wav-c96eab61063b597f9e055d0540dfc4b5.sample"]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=0

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=23 format=3 uid="uid://c1abgp6quvo3o"]
[gd_scene load_steps=26 format=3 uid="uid://c1abgp6quvo3o"]
[ext_resource type="Texture2D" uid="uid://b5baxx5o21qy1" path="res://resources/sprites/Sub/Sub.png" id="1_a6v5r"]
[ext_resource type="Script" path="res://scripts/Day.cs" id="1_cko08"]
@ -11,6 +11,7 @@
[ext_resource type="PackedScene" uid="uid://dfdsnwub212o6" path="res://prefabs/Player.tscn" id="8_csxln"]
[ext_resource type="AudioStream" uid="uid://be35iuapayv0u" path="res://resources/music/Day1.wav" id="9_43nb0"]
[ext_resource type="SpriteFrames" uid="uid://wu7pmuvjw5qm" path="res://resources/sprites/npcs/Empty.tres" id="10_medl6"]
[ext_resource type="AudioStream" uid="uid://cw6y35jglsn1" path="res://resources/sounds/nightmares/D1nm.wav" id="12_jjnbw"]
[ext_resource type="PackedScene" uid="uid://x6pqolxtgwvy" path="res://prefabs/Interactable.tscn" id="12_p32yk"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_h0540"]
@ -256,13 +257,17 @@ stream = SubResource("AudioStreamPlaylist_7838k")
autoplay = true
bus = &"Music"
[node name="Nightmare" type="AudioStreamPlayer" parent="."]
stream = ExtResource("12_jjnbw")
bus = &"Nightmare"
[node name="EndDay" parent="." instance=ExtResource("12_p32yk")]
position = Vector2(985, 245)
SpriteOffset = Vector2(0, -30)
AreaRadius = 20.0
IsEnabled = false
[connection signal="DialogEnded" from="NPCs/Ivan" to="." method="EnableEndDay"]
[connection signal="finished" from="Nightmare" to="." method="ChangeScene"]
[connection signal="OnInteract" from="EndDay" to="." method="ChangeDay"]
[connection signal="PlayerLeft" from="EndDay" to="." method="RemoveEndDay"]
[connection signal="PlayerNearBy" from="EndDay" to="." method="AssignEndDay"]

View file

@ -17,6 +17,7 @@ public partial class Day : Node2D
private Player _player;
private ColorRect _colorRect;
private AudioStreamPlayer _music;
private AudioStreamPlayer _nightmare;
private Interactable _endDay;
private double _transitionTimeout = 0;
@ -27,6 +28,7 @@ public partial class Day : Node2D
_player = (Player)FindChild("Player");
_colorRect = _player.CRect;
_music = (AudioStreamPlayer)FindChild("Music");
_nightmare = (AudioStreamPlayer)FindChild("Nightmare");
_endDay = (Interactable)FindChild("EndDay");
_colorRect.Color = new Color(0, 0, 0, 1f);
_music.VolumeDb = -40;
@ -52,6 +54,11 @@ public partial class Day : Node2D
{
_endDay.Enable();
}
public void ChangeScene()
{
GetNode<SceneManager>("/root/SceneManager").SwitchScene(NextScene);
}
// Called every frame. 'delta' is the elapsed time since the previous frame.
public override void _Process(double delta)
@ -82,7 +89,7 @@ public partial class Day : Node2D
}
else
{
GetNode<SceneManager>("/root/SceneManager").SwitchScene(NextScene);
_nightmare.Play();
}
}
}