diff --git a/scenes/Babushka_scene_indoor_vesnas_room.tscn b/scenes/Babushka_scene_indoor_vesnas_room.tscn index bfe129d..f5adf59 100644 --- a/scenes/Babushka_scene_indoor_vesnas_room.tscn +++ b/scenes/Babushka_scene_indoor_vesnas_room.tscn @@ -1,10 +1,11 @@ -[gd_scene load_steps=14 format=3 uid="uid://ceaa2qj2bmw43"] +[gd_scene load_steps=15 format=3 uid="uid://ceaa2qj2bmw43"] [ext_resource type="Script" uid="uid://cssdu8viimwm6" path="res://scripts/CSharp/Common/SceneTransition.cs" id="1_c6eln"] [ext_resource type="Texture2D" uid="uid://cugtxcfuds31r" path="res://art/indoor/Babushka_bg_01.png" id="2_j25a2"] [ext_resource type="Script" uid="uid://cldtt4atgymm5" path="res://scripts/CSharp/Common/Quest/QuestTrigger.cs" id="8_j25a2"] [ext_resource type="PackedScene" uid="uid://cqc72e4hq6bcd" path="res://prefabs/interactions/interaction_area_2d.tscn" id="8_phqdf"] [ext_resource type="Resource" uid="uid://csj15gnlx1jmx" path="res://resources/quests/demo/8_goto_bed.tres" id="9_heyef"] +[ext_resource type="Script" uid="uid://puw74w6lmcvl" path="res://scripts/CSharp/Common/Fight/NightStarter.cs" id="10_j25a2"] [ext_resource type="Texture2D" uid="uid://cop1vjvhwlsec" path="res://art/indoor/room export/Room_01_shelf.png" id="13_11fdt"] [ext_resource type="PackedScene" uid="uid://c25udixd5m6l0" path="res://prefabs/characters/Player2D.tscn" id="18_3gevq"] [ext_resource type="Script" uid="uid://bqomwxclsbhd3" path="res://scripts/CSharp/Common/Camera/CameraController.cs" id="23_408bg"] @@ -120,9 +121,14 @@ _id = 0 [node name="CollisionShape3D" parent="DoorInteraction/Area2D" index="0"] shape = SubResource("CircleShape2D_2spkc") +[node name="NightStarter" type="Node" parent="."] +script = ExtResource("10_j25a2") +_sceneIndexToLoad = 1 + [connection signal="Interacted" from="BedInteraction" to="BedInteraction/QuestCompleter" method="Trigger"] -[connection signal="InteractedTool" from="BedInteraction" to="." method="LoadSceneAtIndex"] +[connection signal="Interacted" from="BedInteraction" to="NightStarter" method="StartNight"] [connection signal="Interacted" from="DoorInteraction" to="." method="LoadScene"] +[connection signal="LoadScene" from="NightStarter" to="." method="LoadSceneAtIndex"] [editable path="Vesna"] [editable path="BedInteraction"] diff --git a/scripts/CSharp/Common/Fight/FightWorld.cs b/scripts/CSharp/Common/Fight/FightWorld.cs index 7cfb3b4..083b60f 100644 --- a/scripts/CSharp/Common/Fight/FightWorld.cs +++ b/scripts/CSharp/Common/Fight/FightWorld.cs @@ -72,7 +72,6 @@ public partial class FightWorld : Node public override void _EnterTree() { Instance = this; - MyEnterTree(); } #endregion @@ -82,7 +81,7 @@ public partial class FightWorld : Node public FightHappeningData? fightHappeningData = null; public AllyFighters allyFighters = new(); - public void MyEnterTree() + public void ResetFightWorld() { Generate(); currentRoom = world!.rooms[0]; diff --git a/scripts/CSharp/Common/Fight/NightStarter.cs b/scripts/CSharp/Common/Fight/NightStarter.cs new file mode 100644 index 0000000..2690dc1 --- /dev/null +++ b/scripts/CSharp/Common/Fight/NightStarter.cs @@ -0,0 +1,16 @@ +using Godot; +using System; +using Babushka.scripts.CSharp.Common.Fight; + +public partial class NightStarter : Node +{ + [Export] private int _sceneIndexToLoad; + + [Signal] public delegate void LoadSceneEventHandler(int index); + + public void StartNight() + { + FightWorld.Instance.ResetFightWorld(); + EmitSignalLoadScene(_sceneIndexToLoad); + } +} diff --git a/scripts/CSharp/Common/Fight/NightStarter.cs.uid b/scripts/CSharp/Common/Fight/NightStarter.cs.uid new file mode 100644 index 0000000..14436e0 --- /dev/null +++ b/scripts/CSharp/Common/Fight/NightStarter.cs.uid @@ -0,0 +1 @@ +uid://puw74w6lmcvl