Merge branch 'main' of https://git.zenny.quest/zenayi/GameJamDungeon
This commit is contained in:
@@ -25,4 +25,6 @@ public interface IMap : INode3D
|
||||
public AutoProp<int> CurrentFloorNumber { get; }
|
||||
|
||||
public event Action<Transform3D> SpawnPointCreated;
|
||||
|
||||
public event Action FloorLoaded;
|
||||
}
|
||||
|
||||
@@ -30,15 +30,16 @@ public partial class Map : Node3D, IMap
|
||||
|
||||
public event Action<Transform3D> SpawnPointCreated;
|
||||
|
||||
public event Action FloorLoaded;
|
||||
|
||||
public void OnResolved()
|
||||
{
|
||||
this.Provide();
|
||||
InitializeMapData();
|
||||
}
|
||||
|
||||
public void InitializeMapData()
|
||||
{
|
||||
CurrentFloorNumber.OnNext(0);
|
||||
CurrentFloorNumber.OnNext(-1);
|
||||
}
|
||||
|
||||
public IDungeonRoom GetPlayersCurrentRoom()
|
||||
@@ -52,7 +53,7 @@ public partial class Map : Node3D, IMap
|
||||
|
||||
public async Task LoadFloor()
|
||||
{
|
||||
var floor = MapOrder.GetChildren().OfType<FloorNode>().ElementAt(CurrentFloorNumber.Value);
|
||||
var floor = MapOrder.GetChildren().OfType<FloorNode>().ElementAt(CurrentFloorNumber.Value + 1);
|
||||
var sceneToLoad = LayoutToScenePathConverter.Convert(floor);
|
||||
await LoadFloor(sceneToLoad);
|
||||
if (CurrentFloor is DungeonFloor dungeonFloor && floor is DungeonFloorNode dungeonFloorNode)
|
||||
@@ -82,6 +83,7 @@ public partial class Map : Node3D, IMap
|
||||
SetupDungeonFloor();
|
||||
CurrentFloor.FloorIsLoaded = true;
|
||||
CurrentFloorNumber.OnNext(CurrentFloorNumber.Value + 1);
|
||||
FloorLoaded?.Invoke();
|
||||
}
|
||||
|
||||
private async Task<Node> LoadNewFloor(string sceneName)
|
||||
|
||||
@@ -76,6 +76,10 @@ libraries = {
|
||||
[node name="MapOrder" type="Node" parent="."]
|
||||
unique_name_in_owner = true
|
||||
|
||||
[node name="Altar" type="Node" parent="MapOrder"]
|
||||
script = ExtResource("3_v14r0")
|
||||
FloorName = 1
|
||||
|
||||
[node name="FirstFloor" type="Node" parent="MapOrder"]
|
||||
script = ExtResource("2_00xd7")
|
||||
FolderName = "SetAFloors"
|
||||
|
||||
Reference in New Issue
Block a user