diff --git a/DungeonShooting_Godot/src/framework/map/GenerateDungeon.cs b/DungeonShooting_Godot/src/framework/map/GenerateDungeon.cs index ffa5a19..198ba76 100644 --- a/DungeonShooting_Godot/src/framework/map/GenerateDungeon.cs +++ b/DungeonShooting_Godot/src/framework/map/GenerateDungeon.cs @@ -1,4 +1,5 @@ +using System; using System.Collections.Generic; using Godot; @@ -454,6 +455,43 @@ return true; } + /// + /// 查找房间的连接通道, 函数返回是否找到对应的门, 通过 result 返回 x/y 轴坐标 + /// + /// 第一个房间 + /// 第二个房间 + /// 第一个房间连接方向 + /// 返回连接的 x/y 轴坐标 + private bool FindPassage(RoomInfo room, RoomInfo nextRoom, DoorDirection direction, out int result) + { + var room1 = room.RoomSplit.RoomInfo; + var room2 = nextRoom.RoomSplit.RoomInfo; + + foreach (var doorAreaInfo1 in room1.DoorAreaInfos) + { + if (doorAreaInfo1.Direction == direction) + { + + switch (direction) + { + case DoorDirection.E: + break; + case DoorDirection.W: + break; + case DoorDirection.S: //第二个门向↑ + + break; + case DoorDirection.N: //第二个门向↓ + + break; + } + } + } + + result = 0; + return false; + } + //用于计算重叠区域坐标, 可以理解为一维轴上4个点的中间两个点 private Vector2 CalcOverlapRange(float start1, float end1, float start2, float end2) {