✨Added end of night scene
This commit is contained in:
@@ -6,3 +6,4 @@
|
|||||||
script = ExtResource("1_5dt1r")
|
script = ExtResource("1_5dt1r")
|
||||||
_fightRoomScenePath = "res://scenes/Babushka_scene_fight_world_room.tscn"
|
_fightRoomScenePath = "res://scenes/Babushka_scene_fight_world_room.tscn"
|
||||||
_fightHappeningScene = "res://scenes/Babushka_scene_fight_happening.tscn"
|
_fightHappeningScene = "res://scenes/Babushka_scene_fight_happening.tscn"
|
||||||
|
_nightEndScene = "res://scenes/Babushka_scene_indoor_vesnas_room.tscn"
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ public partial class FightSceneSwitcher : Node
|
|||||||
[Export] private Node _sceneRoot = null!;
|
[Export] private Node _sceneRoot = null!;
|
||||||
[Export] private string _fightRoomScenePath = null!;
|
[Export] private string _fightRoomScenePath = null!;
|
||||||
[Export] private string _fightHappeningScene = null!;
|
[Export] private string _fightHappeningScene = null!;
|
||||||
|
[Export] private string _nightEndScene = null!;
|
||||||
|
|
||||||
private void LoadNext()
|
private void LoadNext()
|
||||||
{
|
{
|
||||||
@@ -36,6 +37,12 @@ public partial class FightSceneSwitcher : Node
|
|||||||
if (!FightWorld.Instance.currentRoom.paths.TryGetValue(pathIndex, out var nextRoom))
|
if (!FightWorld.Instance.currentRoom.paths.TryGetValue(pathIndex, out var nextRoom))
|
||||||
throw new Exception("Trying to go down a non-existent path");
|
throw new Exception("Trying to go down a non-existent path");
|
||||||
|
|
||||||
|
if (nextRoom.specialRoom == FightWorld.Room.Special.EndOfNight)
|
||||||
|
{
|
||||||
|
ExitFightWorld();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
FightWorld.Instance.currentRoom = nextRoom;
|
FightWorld.Instance.currentRoom = nextRoom;
|
||||||
LoadNext();
|
LoadNext();
|
||||||
}
|
}
|
||||||
@@ -60,4 +67,10 @@ public partial class FightSceneSwitcher : Node
|
|||||||
FightWorld.Instance.fightHappeningData = null;
|
FightWorld.Instance.fightHappeningData = null;
|
||||||
LoadNext();
|
LoadNext();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void ExitFightWorld()
|
||||||
|
{
|
||||||
|
SceneTransitionThreaded.Instance.ChangeSceneToFile(_nightEndScene);
|
||||||
|
_ = UnloadAfterDelay();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -14,8 +14,14 @@ public partial class FightWorld : Node
|
|||||||
|
|
||||||
public class Room
|
public class Room
|
||||||
{
|
{
|
||||||
|
public enum Special
|
||||||
|
{
|
||||||
|
None,
|
||||||
|
EndOfNight
|
||||||
|
}
|
||||||
public required Dictionary<int, Room> paths;
|
public required Dictionary<int, Room> paths;
|
||||||
public required List<FighterGroup> enemyGroups;
|
public required List<FighterGroup> enemyGroups;
|
||||||
|
public Special specialRoom = Special.None;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class FighterGroup
|
public class FighterGroup
|
||||||
@@ -108,6 +114,13 @@ public partial class FightWorld : Node
|
|||||||
{
|
{
|
||||||
rooms.Add(GenerateDisconnectedRoom());
|
rooms.Add(GenerateDisconnectedRoom());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rooms.Add(new Room
|
||||||
|
{
|
||||||
|
paths = [],
|
||||||
|
enemyGroups = [],
|
||||||
|
specialRoom = Room.Special.EndOfNight
|
||||||
|
});
|
||||||
|
|
||||||
// Connect rooms linearly
|
// Connect rooms linearly
|
||||||
for (var i = 0; i < rooms.Count - 1; i++)
|
for (var i = 0; i < rooms.Count - 1; i++)
|
||||||
|
|||||||
Reference in New Issue
Block a user