diff --git a/DungeonShooting_Godot/DungeonShooting.csproj b/DungeonShooting_Godot/DungeonShooting.csproj index c3657b9..0d44898 100644 --- a/DungeonShooting_Godot/DungeonShooting.csproj +++ b/DungeonShooting_Godot/DungeonShooting.csproj @@ -1,4 +1,4 @@ -<Project Sdk="Godot.NET.Sdk/4.0.0-rc.3"> +<Project Sdk="Godot.NET.Sdk/4.0.0-rc.5"> <PropertyGroup> <TargetFramework>net6.0</TargetFramework> <EnableDynamicLoading>true</EnableDynamicLoading> diff --git a/DungeonShooting_Godot/DungeonShooting.csproj.old.4 b/DungeonShooting_Godot/DungeonShooting.csproj.old.4 new file mode 100644 index 0000000..c3657b9 --- /dev/null +++ b/DungeonShooting_Godot/DungeonShooting.csproj.old.4 @@ -0,0 +1,6 @@ +<Project Sdk="Godot.NET.Sdk/4.0.0-rc.3"> + <PropertyGroup> + <TargetFramework>net6.0</TargetFramework> + <EnableDynamicLoading>true</EnableDynamicLoading> + </PropertyGroup> +</Project> \ No newline at end of file diff --git a/DungeonShooting_Godot/src/framework/map/GenerateDungeon.cs b/DungeonShooting_Godot/src/framework/map/GenerateDungeon.cs index 84e950d..c044a03 100644 --- a/DungeonShooting_Godot/src/framework/map/GenerateDungeon.cs +++ b/DungeonShooting_Godot/src/framework/map/GenerateDungeon.cs @@ -410,6 +410,8 @@ roomDoor.Direction = DoorDirection.N; //↑ nextRoomDoor.Direction = DoorDirection.E; //→ + FindCrossPassage(room, nextRoom, roomDoor, nextRoomDoor); + roomDoor.OriginPosition = new Vector2(room.Position.X + offset1, room.Position.Y); nextRoomDoor.OriginPosition = new Vector2(nextRoom.Position.X + nextRoom.Size.X, nextRoom.Position.Y + nextRoom.Size.Y - offset2 - 6); @@ -420,6 +422,8 @@ roomDoor.Direction = DoorDirection.W; //← nextRoomDoor.Direction = DoorDirection.S; //↓ + FindCrossPassage(room, nextRoom, roomDoor, nextRoomDoor); + roomDoor.OriginPosition = new Vector2(room.Position.X, room.Position.Y + offset2); nextRoomDoor.OriginPosition = new Vector2(nextRoom.Position.X + nextRoom.Size.X - offset1 - 6, nextRoom.Position.Y + nextRoom.Size.Y); @@ -432,6 +436,8 @@ { roomDoor.Direction = DoorDirection.S; //↓ nextRoomDoor.Direction = DoorDirection.E; //→ + + FindCrossPassage(room, nextRoom, roomDoor, nextRoomDoor); roomDoor.OriginPosition = new Vector2(room.Position.X + offset1, room.Position.Y + room.Size.Y); nextRoomDoor.OriginPosition = new Vector2(nextRoom.Position.X + nextRoom.Size.X, @@ -442,6 +448,8 @@ { roomDoor.Direction = DoorDirection.W; //← nextRoomDoor.Direction = DoorDirection.N; //↑ + + FindCrossPassage(room, nextRoom, roomDoor, nextRoomDoor); roomDoor.OriginPosition = new Vector2(room.Position.X, room.Position.Y + room.Size.Y - offset2 - 6); // @@ -518,7 +526,7 @@ return true; } - private void Test(RoomInfo room, RoomInfo nextRoom, RoomDoorInfo roomDoor, RoomDoorInfo nextRoomDoor) + private void FindCrossPassage(RoomInfo room, RoomInfo nextRoom, RoomDoorInfo roomDoor, RoomDoorInfo nextRoomDoor) { var room1 = room.RoomSplit.RoomInfo; var room2 = nextRoom.RoomSplit.RoomInfo; @@ -533,7 +541,7 @@ { if (areaInfo1.Direction == roomDoor.Direction) { - if (areaInfo1.Direction == DoorDirection.N || areaInfo1.Direction == DoorDirection.S) //横向 + if (areaInfo1.Direction == DoorDirection.N || areaInfo1.Direction == DoorDirection.S) //纵向门 { var p1 = tempX + areaInfo1.Start; var p2 = tempX + areaInfo1.End; @@ -560,11 +568,33 @@ } } } - else //纵向 + else //横向门 { var p1 = tempY + areaInfo1.Start; var p2 = tempY + areaInfo1.End; - + + if (room.Position.Y > nextRoom.Position.Y) + { + if (IsInRange(nextRoom.GetVerticalEnd() * TileCellSize, + room.GetVerticalEnd() * TileCellSize, p1, p2)) + { + if (tempArea1 == null || areaInfo1.Start < tempArea1.Start) + { + tempArea1 = areaInfo1; + } + } + } + else + { + if (IsInRange(room.GetVerticalStart() * TileCellSize, + nextRoom.GetVerticalStart() * TileCellSize, p1, p2)) + { + if (tempArea1 == null || areaInfo1.End > tempArea1.End) + { + tempArea1 = areaInfo1; + } + } + } } } } diff --git a/README.md b/README.md index b99f7ee..b7e2c78 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,2 @@ 目前项目已经从Godot3x迁移至Godot4x<br> -当前Godot版本: 4.0rc3, 请使用指定的Godot版打本开项目 \ No newline at end of file +当前Godot版本: 4.0rc5, 请使用指定的Godot版打本开项目 \ No newline at end of file