From 9f50e1d29378636ec8ea999c79d60b4a335ddf00 Mon Sep 17 00:00:00 2001 From: kziolkowski Date: Wed, 27 Aug 2025 18:21:28 +0200 Subject: [PATCH] WIP trying to implement pickup sounds --- prefabs/characters/Player2D.tscn | 1 + .../generic_item_on_ground_2d.tscn | 23 ++++++++++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/prefabs/characters/Player2D.tscn b/prefabs/characters/Player2D.tscn index 0ac78de..e2308b9 100644 --- a/prefabs/characters/Player2D.tscn +++ b/prefabs/characters/Player2D.tscn @@ -2192,4 +2192,5 @@ wait_time = 0.5 [connection signal="WateringField" from="FarmingControls" to="CharacterBody2D/WateringCanUI" method="Water"] [connection signal="timelineEnded" from="dialogic toggle" to="." method="EnableMovement"] [connection signal="timelineStarted" from="dialogic toggle" to="." method="DisableMovement"] +[connection signal="timelineStarted" from="DialogicToggle" to="SFX/FootstepsAudio/Timer" method="stop"] [connection signal="timeout" from="SFX/FootstepsAudio/Timer" to="SFX/FootstepsAudio" method="PlayOneShot"] diff --git a/prefabs/interactions/generic_item_on_ground_2d.tscn b/prefabs/interactions/generic_item_on_ground_2d.tscn index af32756..c43511a 100644 --- a/prefabs/interactions/generic_item_on_ground_2d.tscn +++ b/prefabs/interactions/generic_item_on_ground_2d.tscn @@ -1,10 +1,15 @@ -[gd_scene load_steps=9 format=3 uid="uid://dpbbroif2tnil"] +[gd_scene load_steps=15 format=3 uid="uid://dpbbroif2tnil"] [ext_resource type="Script" uid="uid://btusf04xnywhm" path="res://scripts/CSharp/Common/Inventory/ItemOnGround2D.cs" id="1_tlhp6"] [ext_resource type="Script" uid="uid://c8suoi3i6kqai" path="res://scripts/CSharp/Common/Inventory/ItemOnGroundSpawnWith.cs" id="3_xu8me"] [ext_resource type="Material" uid="uid://bv3m12duf0dj6" path="res://art/materials/inventory_interactable_outline.tres" id="4_harr4"] [ext_resource type="PackedScene" uid="uid://cqc72e4hq6bcd" path="res://prefabs/interactions/interaction_area_2d.tscn" id="4_xu8me"] [ext_resource type="Texture2D" uid="uid://cfxibry711o16" path="res://art/ui/UI/icons/icon-scythe.png" id="5_harr4"] +[ext_resource type="AudioStream" uid="uid://bw630minafpvb" path="res://audio/sfx/UI/SFX_ItemPickUp_01.wav" id="6_gcj2v"] +[ext_resource type="AudioStream" uid="uid://by8ubxnfbrisv" path="res://audio/sfx/UI/SFX_ItemPickUp_02.wav" id="7_edjam"] +[ext_resource type="AudioStream" uid="uid://bqm6rchwtelxj" path="res://audio/sfx/UI/SFX_ItemPickUp_03.wav" id="8_kflfw"] +[ext_resource type="AudioStream" uid="uid://brsufnpmig5fv" path="res://audio/sfx/UI/SFX_ItemPickUp_04.wav" id="9_dltn0"] +[ext_resource type="Script" uid="uid://dx25g14a7xi4w" path="res://scripts/CSharp/Common/Audio/AudioPlayer.cs" id="10_clbey"] [sub_resource type="Theme" id="Theme_tlhp6"] default_font_size = 80 @@ -16,6 +21,13 @@ default_font_size = 40 resource_local_to_scene = true radius = 300.0 +[sub_resource type="AudioStreamRandomizer" id="AudioStreamRandomizer_7mdru"] +streams_count = 4 +stream_0/stream = ExtResource("6_gcj2v") +stream_1/stream = ExtResource("7_edjam") +stream_2/stream = ExtResource("8_kflfw") +stream_3/stream = ExtResource("9_dltn0") + [node name="GenericItemOnGround" type="Node2D"] z_index = 1 y_sort_enabled = true @@ -55,6 +67,15 @@ position = Vector2(5, -300) scale = Vector2(0.868852, 0.868852) texture = ExtResource("5_harr4") +[node name="SFX" type="Node" parent="."] + +[node name="PickUpSound" type="AudioStreamPlayer" parent="SFX"] +stream = SubResource("AudioStreamRandomizer_7mdru") +bus = &"SFX" +playback_type = 2 +script = ExtResource("10_clbey") + [connection signal="Interacted" from="PickupInteractionArea" to="." method="TryPickUp"] +[connection signal="Interacted" from="PickupInteractionArea" to="SFX/PickUpSound" method="PlayOneShot"] [editable path="PickupInteractionArea"]