diff --git a/Babushka.sln.DotSettings.user b/Babushka.sln.DotSettings.user index 8a6aa15..4e7cbcc 100644 --- a/Babushka.sln.DotSettings.user +++ b/Babushka.sln.DotSettings.user @@ -1,4 +1,5 @@  ForceIncluded + ForceIncluded ForceIncluded ForceIncluded \ No newline at end of file diff --git a/audio/Music/Farming_90BPM_69Bars_Loop.wav.import b/audio/Music/Farming_90BPM_69Bars_Loop.wav.import index d47bc71..9bea6d0 100644 --- a/audio/Music/Farming_90BPM_69Bars_Loop.wav.import +++ b/audio/Music/Farming_90BPM_69Bars_Loop.wav.import @@ -18,7 +18,7 @@ force/max_rate=false force/max_rate_hz=44100 edit/trim=false edit/normalize=false -edit/loop_mode=0 +edit/loop_mode=2 edit/loop_begin=0 edit/loop_end=-1 compress/mode=2 diff --git a/scenes/Babushka_scene_farm_outside_2d.tscn b/scenes/Babushka_scene_farm_outside_2d.tscn index ac20c04..d53b589 100644 --- a/scenes/Babushka_scene_farm_outside_2d.tscn +++ b/scenes/Babushka_scene_farm_outside_2d.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=61 format=3 uid="uid://gigb28qk8t12"] +[gd_scene load_steps=67 format=3 uid="uid://gigb28qk8t12"] [ext_resource type="PackedScene" uid="uid://c25udixd5m6l0" path="res://prefabs/characters/Player2D.tscn" id="1_7wfwe"] [ext_resource type="Texture2D" uid="uid://8sr11ex30n0m" path="res://art/mockups/Kenney_Backgrounds/Samples/uncolored_hills.png" id="2_7b2ri"] @@ -37,6 +37,10 @@ [ext_resource type="Resource" uid="uid://datee0flk1e84" path="res://resources/items/scythe.tres" id="29_wtdui"] [ext_resource type="PackedScene" uid="uid://cgjc4wurbgimy" path="res://prefabs/UI/Inventory/Inventory.tscn" id="32_2nee2"] [ext_resource type="AudioStream" uid="uid://cfqg50am0swb7" path="res://audio/Music/Farming_90BPM_69Bars_Loop.wav" id="37_8ey8m"] +[ext_resource type="AudioStream" uid="uid://dku1rq5cocisg" path="res://audio/Music/Farming_90BPM_69Bars.wav" id="37_di1ed"] +[ext_resource type="AudioStream" uid="uid://vcftvrpi6c7k" path="res://audio/sfx/Farming/SFX_Harke_03_Solo.wav" id="39_di1ed"] +[ext_resource type="AudioStream" uid="uid://bxh5m04vdo0sr" path="res://audio/sfx/Farming/SFX_Harke_04_Solo.wav" id="39_w3jkj"] +[ext_resource type="Script" uid="uid://cfnrd5k1k0gxw" path="res://scripts/CSharp/Common/AudioPlayer.cs" id="40_w3jkj"] [sub_resource type="ShaderMaterial" id="ShaderMaterial_wtdui"] shader = ExtResource("13_7p0hq") @@ -139,6 +143,17 @@ size = Vector2(12082, 1176) resource_local_to_scene = true size = Vector2(7340, 1192) +[sub_resource type="AudioStreamPlaylist" id="AudioStreamPlaylist_ceriq"] +loop = false +stream_count = 2 +stream_0 = ExtResource("37_di1ed") +stream_1 = ExtResource("37_8ey8m") + +[sub_resource type="AudioStreamRandomizer" id="AudioStreamRandomizer_ceriq"] +streams_count = 2 +stream_0/stream = ExtResource("39_di1ed") +stream_1/stream = ExtResource("39_w3jkj") + [node name="BabushkaSceneFarmOutside2d" type="Node2D"] [node name="ParallaxBackground" type="ParallaxBackground" parent="."] @@ -900,7 +915,8 @@ polygon = PackedVector2Array(232, -4.80005, 0, 0, 0, -96, -262.4, -97.6, -265.6, disabled = true [node name="FieldParent" type="Node2D" parent="YSorted/Farm visuals"] -position = Vector2(48, 0) +position = Vector2(53, 20) +scale = Vector2(1, 0.993819) script = ExtResource("25_0qu0h") metadata/_custom_type_script = "uid://dhxtdhfqx3bte" @@ -937,12 +953,20 @@ _inventoryOpenedOffset = -600.0 [node name="Background Music" type="AudioStreamPlayer2D" parent="Audio"] position = Vector2(4002, 2030) -stream = ExtResource("37_8ey8m") -volume_db = -10.0 +stream = SubResource("AudioStreamPlaylist_ceriq") +volume_db = -15.0 autoplay = true max_distance = 1e+06 +[node name="SFX" type="Node" parent="Audio"] + +[node name="Farming SFX" type="AudioStreamPlayer2D" parent="Audio/SFX"] +stream = SubResource("AudioStreamRandomizer_ceriq") +max_distance = 2e+07 +script = ExtResource("40_w3jkj") + [connection signal="InteractedTool" from="YSorted/Brünnen/InteractionArea" to="YSorted/Vesna" method="TryFillWateringCan"] +[connection signal="FieldCreated" from="YSorted/Farm visuals/FieldParent" to="Audio/SFX/Farming SFX" method="PlayOneShot"] [connection signal="mouse_entered" from="YSorted/Farm visuals/FieldParent/Area2D" to="YSorted/Farm visuals/FieldParent" method="MouseEnteredAllowedArea"] [connection signal="mouse_exited" from="YSorted/Farm visuals/FieldParent/Area2D" to="YSorted/Farm visuals/FieldParent" method="MouseExitedAllowedArea"] diff --git a/scripts/CSharp/Common/AudioPlayer.cs b/scripts/CSharp/Common/AudioPlayer.cs new file mode 100644 index 0000000..1be2174 --- /dev/null +++ b/scripts/CSharp/Common/AudioPlayer.cs @@ -0,0 +1,14 @@ +using Godot; + +namespace Babushka.scripts.CSharp.Common; + +public partial class AudioPlayer : AudioStreamPlayer2D +{ + /// + /// For SFX and other audio that should be played only once and not looped. + /// + public void PlayOneShot() + { + Play(); + } +} \ No newline at end of file diff --git a/scripts/CSharp/Common/AudioPlayer.cs.uid b/scripts/CSharp/Common/AudioPlayer.cs.uid new file mode 100644 index 0000000..3260e33 --- /dev/null +++ b/scripts/CSharp/Common/AudioPlayer.cs.uid @@ -0,0 +1 @@ +uid://cfnrd5k1k0gxw diff --git a/scripts/CSharp/Common/Farming/FieldService2D.cs b/scripts/CSharp/Common/Farming/FieldService2D.cs index a9497dc..43536c9 100644 --- a/scripts/CSharp/Common/Farming/FieldService2D.cs +++ b/scripts/CSharp/Common/Farming/FieldService2D.cs @@ -9,6 +9,8 @@ public partial class FieldService2D : Node2D [Export] private Dictionary fields = new Dictionary(); private bool _fieldAllowed = false; + + [Signal] public delegate void FieldCreatedEventHandler(); //Validate @@ -33,6 +35,7 @@ public partial class FieldService2D : Node2D if (!fields.ContainsKey(key)) { fields.Add(key, field); + EmitSignal(SignalName.FieldCreated); return true; } return false;