diff --git a/DungeonShooting_Godot/resource/map/tileMaps/TestGroup2/battle/Battle1/Preview.png b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup2/battle/Battle1/Preview.png index 1c3c4aa..ebb1434 100644 --- a/DungeonShooting_Godot/resource/map/tileMaps/TestGroup2/battle/Battle1/Preview.png +++ b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup2/battle/Battle1/Preview.png Binary files differ diff --git a/DungeonShooting_Godot/resource/map/tileMaps/TestGroup2/battle/Battle1/RoomInfo.json b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup2/battle/Battle1/RoomInfo.json index 1f945c7..d046b67 100644 --- a/DungeonShooting_Godot/resource/map/tileMaps/TestGroup2/battle/Battle1/RoomInfo.json +++ b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup2/battle/Battle1/RoomInfo.json @@ -1 +1 @@ -{"Position":{"X":-2,"Y":-3},"Size":{"X":15,"Y":13},"DoorAreaInfos":[],"GroupName":"TestGroup2","RoomType":0,"RoomName":"Battle1","Weight":100,"Remark":""} \ No newline at end of file +{"Position":{"X":-2,"Y":-3},"Size":{"X":22,"Y":16},"DoorAreaInfos":[{"Direction":3,"Start":0,"End":160},{"Direction":0,"Start":0,"End":176},{"Direction":1,"Start":0,"End":176},{"Direction":2,"Start":0,"End":96},{"Direction":2,"Start":160,"End":288},{"Direction":3,"Start":224,"End":288}],"GroupName":"TestGroup2","RoomType":0,"RoomName":"Battle1","Weight":100,"Remark":""} \ No newline at end of file diff --git a/DungeonShooting_Godot/resource/map/tileMaps/TestGroup2/battle/Battle1/TileInfo.json b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup2/battle/Battle1/TileInfo.json index 4905000..d2f5527 100644 --- a/DungeonShooting_Godot/resource/map/tileMaps/TestGroup2/battle/Battle1/TileInfo.json +++ b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup2/battle/Battle1/TileInfo.json @@ -1 +1 @@ -{"NavigationVertices":[{"X":170,"Y":130},{"X":6,"Y":130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,0,9,2,12,7,0,9,2,12,8,0,9,2,12,9,0,9,2]} \ No newline at end of file +{"NavigationVertices":[{"X":230,"Y":54},{"X":230,"Y":6},{"X":282,"Y":6},{"X":282,"Y":178},{"X":166,"Y":178},{"X":166,"Y":130},{"X":154,"Y":54},{"X":90,"Y":130},{"X":90,"Y":178},{"X":6,"Y":178},{"X":6,"Y":6},{"X":154,"Y":6}],"NavigationPolygon":[[0,1,2,3],[0,3,4,5],[6,0,5,7],[7,8,9,10],[7,10,11,6]],"Floor":[0,0,0,0,4,0,1,0,0,4,0,2,0,0,4,1,0,0,0,4,1,1,0,0,4,1,2,0,0,4,2,0,0,0,4,2,1,0,0,4,2,2,0,0,4,3,0,0,0,4,3,1,0,0,4,3,2,0,0,4,0,3,0,0,4,1,3,0,0,4,2,3,0,0,4,3,3,0,0,4,4,0,0,0,4,5,0,0,0,4,6,0,0,0,4,7,0,0,0,4,8,0,0,0,4,9,0,0,0,4,9,1,0,0,4,9,2,0,0,4,9,3,0,0,4,9,4,0,0,4,8,4,0,0,4,7,4,0,0,4,6,4,0,0,4,0,4,0,0,4,0,5,0,0,4,0,6,0,0,4,0,7,0,0,4,1,4,0,0,4,1,5,0,0,4,1,6,0,0,4,1,7,0,0,4,2,4,0,0,4,2,5,0,0,4,2,6,0,0,4,2,7,0,0,4,3,4,0,0,4,3,5,0,0,4,3,6,0,0,4,3,7,0,0,4,4,1,0,0,4,4,2,0,0,4,4,3,0,0,4,4,4,0,0,4,4,5,0,0,4,4,6,0,0,4,4,7,0,0,4,5,1,0,0,4,5,2,0,0,4,5,3,0,0,4,5,4,0,0,4,5,5,0,0,4,5,6,0,0,4,5,7,0,0,4,6,1,0,0,4,6,2,0,0,4,6,3,0,0,4,6,5,0,0,4,6,6,0,0,4,6,7,0,0,4,7,1,0,0,4,7,2,0,0,4,7,3,0,0,4,7,5,0,0,4,7,6,0,0,4,7,7,0,0,4,8,1,0,0,4,8,2,0,0,4,8,3,0,0,4,8,5,0,0,4,8,6,0,0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8,-3,0,9,2,8,8,0,10,0,8,9,0,9,2,8,10,0,9,2,8,11,0,9,2,8,12,0,9,2,9,-3,0,9,2,9,8,0,11,0,9,9,0,11,2,9,10,0,11,2,9,11,0,6,1,9,12,0,9,2,10,-3,0,9,2,10,-2,0,5,2,10,-1,0,8,1,10,0,0,8,1,10,11,0,10,0,10,12,0,9,2,11,-3,0,9,2,11,-2,0,9,2,11,-1,0,9,2,11,0,0,9,2,11,11,0,10,0,11,12,0,9,2,12,-3,0,9,2,12,-2,0,9,2,12,-1,0,9,2,12,0,0,9,2,12,11,0,10,0,12,12,0,9,2,13,-3,0,9,2,13,-2,0,6,2,13,-1,0,11,2,13,0,0,11,2,13,11,0,10,0,13,12,0,9,2,14,-3,0,9,2,14,11,0,10,0,14,12,0,9,2,15,-3,0,9,2,15,11,0,10,0,15,12,0,9,2,16,-3,0,9,2,16,11,0,10,0,16,12,0,9,2,17,-3,0,9,2,17,11,0,10,0,17,12,0,9,2,18,-3,0,9,2,18,-2,0,5,2,18,-1,0,8,1,18,0,0,8,1,18,1,0,8,1,18,2,0,8,1,18,3,0,8,1,18,4,0,8,1,18,5,0,8,1,18,6,0,8,1,18,7,0,8,1,18,8,0,8,1,18,9,0,8,1,18,10,0,8,1,18,11,0,5,1,18,12,0,9,2,19,-3,0,9,2,19,-2,0,9,2,19,-1,0,9,2,19,0,0,9,2,19,1,0,9,2,19,2,0,9,2,19,3,0,9,2,19,4,0,9,2,19,5,0,9,2,19,6,0,9,2,19,7,0,9,2,19,8,0,9,2,19,9,0,9,2,19,10,0,9,2,19,11,0,9,2,19,12,0,9,2]} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/framework/map/DungeonGenerator.cs b/DungeonShooting_Godot/src/framework/map/DungeonGenerator.cs index f73673d..b43adce 100644 --- a/DungeonShooting_Godot/src/framework/map/DungeonGenerator.cs +++ b/DungeonShooting_Godot/src/framework/map/DungeonGenerator.cs @@ -50,13 +50,16 @@ private int _roomMaxInterval = 5; //房间横轴分散程度 - private float _roomHorizontalMinDispersion = -3f; - private float _roomHorizontalMaxDispersion = 3f; + private float _roomHorizontalMinDispersion = -0.6f; + private float _roomHorizontalMaxDispersion = 0.6f; //房间纵轴分散程度 - private float _roomVerticalMinDispersion = -3f; - private float _roomVerticalMaxDispersion = 3f; + private float _roomVerticalMinDispersion = -0.6f; + private float _roomVerticalMaxDispersion = 0.6f; + //房间最大层级 + private int _maxLayer = 5; + //区域限制 private bool _enableLimitRange = true; private int _rangeX = 120; @@ -193,9 +196,9 @@ { if (chainTryCount < chainMaxTryCount) { - if (prevRoomInfo != null && prevRoomInfo.Layer > 6) //层数太高, 下一个房间生成在低层级 + if (prevRoomInfo != null && prevRoomInfo.Layer >= _maxLayer - 1) //层数太高, 下一个房间生成在低层级 { - tempPrevRoomInfo = RoundRoomLessThanLayer(3); + tempPrevRoomInfo = RoundRoomLessThanLayer(Mathf.Max(1, _maxLayer / 2)); } else { @@ -585,25 +588,25 @@ nextRoomDoor.ConnectRoom = roomInfo; nextRoomDoor.ConnectDoor = roomDoor; - // //先寻找直通门 - // if (_random.RandomBoolean()) - // { - // //直行通道, 优先横轴 - // if (TryConnectHorizontalDoor(roomInfo, roomDoor, nextRoomInfo, nextRoomDoor) - // || TryConnectVerticalDoor(roomInfo, roomDoor, nextRoomInfo, nextRoomDoor)) - // { - // return true; - // } - // } - // else - // { - // //直行通道, 优先纵轴 - // if (TryConnectVerticalDoor(roomInfo, roomDoor, nextRoomInfo, nextRoomDoor) - // || TryConnectHorizontalDoor(roomInfo, roomDoor, nextRoomInfo, nextRoomDoor)) - // { - // return true; - // } - // } + //先寻找直通门 + if (_random.RandomBoolean()) + { + //直行通道, 优先横轴 + if (TryConnectHorizontalDoor(roomInfo, roomDoor, nextRoomInfo, nextRoomDoor) + || TryConnectVerticalDoor(roomInfo, roomDoor, nextRoomInfo, nextRoomDoor)) + { + return true; + } + } + else + { + //直行通道, 优先纵轴 + if (TryConnectVerticalDoor(roomInfo, roomDoor, nextRoomInfo, nextRoomDoor) + || TryConnectHorizontalDoor(roomInfo, roomDoor, nextRoomInfo, nextRoomDoor)) + { + return true; + } + } //包含拐角的通道 return TryConnectCrossDoor(roomInfo, roomDoor, nextRoomInfo, nextRoomDoor); @@ -744,7 +747,6 @@ } else { - return false; if (_random.RandomBoolean()) //↓ //→ { if (!TryConnect_SE_Door(roomInfo, nextRoomInfo, roomDoor, nextRoomDoor, ref cross) && @@ -765,7 +767,6 @@ } else { - return false; if (roomInfo.GetVerticalStart() > nextRoomInfo.GetVerticalStart()) //→ //↓ { if (_random.RandomBoolean()) diff --git a/DungeonShooting_Godot/src/game/GameApplication.cs b/DungeonShooting_Godot/src/game/GameApplication.cs index ce2c7f5..a7229fe 100644 --- a/DungeonShooting_Godot/src/game/GameApplication.cs +++ b/DungeonShooting_Godot/src/game/GameApplication.cs @@ -98,7 +98,7 @@ DungeonConfig = new DungeonConfig(); DungeonConfig.GroupName = "TestGroup2"; - DungeonConfig.RoomCount = 15; + DungeonConfig.RoomCount = 20; } public override void _EnterTree() @@ -110,7 +110,7 @@ //固定帧率 Engine.MaxFps = TargetFps; //调试绘制开关 - ActivityObject.IsDebug = true; + ActivityObject.IsDebug = false; //Engine.TimeScale = 0.2f; //调整窗口分辨率 OnWindowSizeChanged(); diff --git a/DungeonShooting_Godot/src/game/activity/role/player/Player.cs b/DungeonShooting_Godot/src/game/activity/role/player/Player.cs index aff1ef2..482be7a 100644 --- a/DungeonShooting_Godot/src/game/activity/role/player/Player.cs +++ b/DungeonShooting_Godot/src/game/activity/role/player/Player.cs @@ -61,9 +61,9 @@ ActivePropsPack.SetCapacity(1); // debug用 - RoleState.Acceleration = 3000; - RoleState.Friction = 3000; - RoleState.MoveSpeed = 500; + // RoleState.Acceleration = 3000; + // RoleState.Friction = 3000; + // RoleState.MoveSpeed = 500; // CollisionLayer = 0; // CollisionMask = 0; // GameCamera.Main.Zoom = new Vector2(0.5f, 0.5f); diff --git a/DungeonShooting_Godot/src/game/room/DungeonManager.cs b/DungeonShooting_Godot/src/game/room/DungeonManager.cs index 551210f..5ba2fde 100644 --- a/DungeonShooting_Godot/src/game/room/DungeonManager.cs +++ b/DungeonShooting_Godot/src/game/room/DungeonManager.cs @@ -693,6 +693,10 @@ { aisleSprite.Position = doorInfo.OriginPosition - new Vector2I(0, doorInfo.AislePreviewTexture.GetHeight() - 1); } + else if (doorInfo.ConnectDoor.Direction == DoorDirection.E) + { + aisleSprite.Position = doorInfo.OriginPosition - new Vector2I(doorInfo.AislePreviewTexture.GetWidth() - 4, doorInfo.AislePreviewTexture.GetHeight() - 1); + } else { aisleSprite.Position = doorInfo.OriginPosition; @@ -704,6 +708,10 @@ { aisleSprite.Position = doorInfo.OriginPosition - new Vector2I(doorInfo.AislePreviewTexture.GetWidth() - 1, 0); } + else if (doorInfo.ConnectDoor.Direction == DoorDirection.S) + { + aisleSprite.Position = doorInfo.OriginPosition - new Vector2I(doorInfo.AislePreviewTexture.GetWidth() - 1, doorInfo.AislePreviewTexture.GetHeight() - 4); + } else { aisleSprite.Position = doorInfo.OriginPosition;