From 3c370e30a0fa7423827b669b51cf3abc3b770514 Mon Sep 17 00:00:00 2001 From: jonathan Date: Tue, 25 Nov 2025 18:07:21 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8Added=20end=20of=20night=20scene?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- prefabs/fight/fight_scene_switcher.tscn | 1 + scripts/CSharp/Common/Fight/FightSceneSwitcher.cs | 13 +++++++++++++ scripts/CSharp/Common/Fight/FightWorld.cs | 13 +++++++++++++ 3 files changed, 27 insertions(+) diff --git a/prefabs/fight/fight_scene_switcher.tscn b/prefabs/fight/fight_scene_switcher.tscn index 8680ba4..f97f04b 100644 --- a/prefabs/fight/fight_scene_switcher.tscn +++ b/prefabs/fight/fight_scene_switcher.tscn @@ -6,3 +6,4 @@ script = ExtResource("1_5dt1r") _fightRoomScenePath = "res://scenes/Babushka_scene_fight_world_room.tscn" _fightHappeningScene = "res://scenes/Babushka_scene_fight_happening.tscn" +_nightEndScene = "res://scenes/Babushka_scene_indoor_vesnas_room.tscn" diff --git a/scripts/CSharp/Common/Fight/FightSceneSwitcher.cs b/scripts/CSharp/Common/Fight/FightSceneSwitcher.cs index 3e4f9c2..185c7b7 100644 --- a/scripts/CSharp/Common/Fight/FightSceneSwitcher.cs +++ b/scripts/CSharp/Common/Fight/FightSceneSwitcher.cs @@ -11,6 +11,7 @@ public partial class FightSceneSwitcher : Node [Export] private Node _sceneRoot = null!; [Export] private string _fightRoomScenePath = null!; [Export] private string _fightHappeningScene = null!; + [Export] private string _nightEndScene = null!; private void LoadNext() { @@ -36,6 +37,12 @@ public partial class FightSceneSwitcher : Node if (!FightWorld.Instance.currentRoom.paths.TryGetValue(pathIndex, out var nextRoom)) throw new Exception("Trying to go down a non-existent path"); + if (nextRoom.specialRoom == FightWorld.Room.Special.EndOfNight) + { + ExitFightWorld(); + return; + } + FightWorld.Instance.currentRoom = nextRoom; LoadNext(); } @@ -60,4 +67,10 @@ public partial class FightSceneSwitcher : Node FightWorld.Instance.fightHappeningData = null; LoadNext(); } + + public void ExitFightWorld() + { + SceneTransitionThreaded.Instance.ChangeSceneToFile(_nightEndScene); + _ = UnloadAfterDelay(); + } } \ No newline at end of file diff --git a/scripts/CSharp/Common/Fight/FightWorld.cs b/scripts/CSharp/Common/Fight/FightWorld.cs index a6ec8d4..7cfb3b4 100644 --- a/scripts/CSharp/Common/Fight/FightWorld.cs +++ b/scripts/CSharp/Common/Fight/FightWorld.cs @@ -14,8 +14,14 @@ public partial class FightWorld : Node public class Room { + public enum Special + { + None, + EndOfNight + } public required Dictionary paths; public required List enemyGroups; + public Special specialRoom = Special.None; } public class FighterGroup @@ -108,6 +114,13 @@ public partial class FightWorld : Node { rooms.Add(GenerateDisconnectedRoom()); } + + rooms.Add(new Room + { + paths = [], + enemyGroups = [], + specialRoom = Room.Special.EndOfNight + }); // Connect rooms linearly for (var i = 0; i < rooms.Count - 1; i++)