diff --git a/DungeonShooting_Godot/DungeonShooting.csproj b/DungeonShooting_Godot/DungeonShooting.csproj index 5aeb111..c3657b9 100644 --- a/DungeonShooting_Godot/DungeonShooting.csproj +++ b/DungeonShooting_Godot/DungeonShooting.csproj @@ -1,4 +1,4 @@ - + net6.0 true diff --git a/DungeonShooting_Godot/DungeonShooting.csproj.old.3 b/DungeonShooting_Godot/DungeonShooting.csproj.old.3 new file mode 100644 index 0000000..5aeb111 --- /dev/null +++ b/DungeonShooting_Godot/DungeonShooting.csproj.old.3 @@ -0,0 +1,6 @@ + + + net6.0 + true + + \ No newline at end of file diff --git a/DungeonShooting_Godot/resource/map/RoomConfig.json b/DungeonShooting_Godot/resource/map/RoomConfig.json index 8eb892d..c2aca58 100644 --- a/DungeonShooting_Godot/resource/map/RoomConfig.json +++ b/DungeonShooting_Godot/resource/map/RoomConfig.json @@ -14,23 +14,33 @@ "DoorAreaInfos": [ { "Direction": 3, - "Start": 16, - "End": 80 + "Start": 64, + "End": 128 }, { "Direction": 2, "Start": 64, - "End": 272 + "End": 128 }, { "Direction": 1, "Start": 16, - "End": 320 + "End": 144 }, { "Direction": 3, "Start": 208, - "End": 320 + "End": 272 + }, + { + "Direction": 2, + "Start": 208, + "End": 272 + }, + { + "Direction": 0, + "Start": 16, + "End": 144 } ] } diff --git a/DungeonShooting_Godot/resource/map/tileMaps/Room3.tscn b/DungeonShooting_Godot/resource/map/tileMaps/Room3.tscn index 25fb9b8..041e568 100644 --- a/DungeonShooting_Godot/resource/map/tileMaps/Room3.tscn +++ b/DungeonShooting_Godot/resource/map/tileMaps/Room3.tscn @@ -8,4 +8,4 @@ format = 2 layer_0/tile_data = PackedInt32Array(1048594, 0, 8, 983058, 0, 8, 917522, 0, 8, 851986, 0, 8, 786450, 0, 8, 720914, 0, 8, 655378, 0, 8, 589842, 0, 8, 524306, 0, 8, 458770, 0, 8, 393234, 0, 8, 327698, 0, 8, 262162, 0, 8, 196626, 0, 8, 131090, 0, 8, 65554, 0, 8, 18, 0, 8, 1048593, 0, 8, 983057, 0, 8, 917521, 0, 8, 851985, 0, 8, 786449, 0, 8, 720913, 0, 8, 655377, 0, 8, 589841, 0, 8, 524305, 0, 8, 458769, 0, 8, 393233, 0, 8, 327697, 0, 8, 262161, 0, 8, 196625, 0, 8, 131089, 0, 8, 65553, 0, 8, 17, 0, 8, 1048592, 0, 8, 983056, 0, 8, 917520, 0, 8, 851984, 0, 8, 786448, 0, 8, 720912, 0, 8, 655376, 0, 8, 589840, 0, 8, 524304, 0, 8, 458768, 0, 8, 393232, 0, 8, 327696, 0, 8, 262160, 0, 8, 196624, 0, 8, 131088, 0, 8, 65552, 0, 8, 16, 0, 8, 1048591, 0, 8, 655375, 0, 8, 589839, 0, 8, 524303, 0, 8, 131087, 0, 8, 65551, 0, 8, 15, 0, 8, 1048590, 0, 8, 655374, 0, 8, 589838, 0, 8, 524302, 0, 8, 131086, 0, 8, 65550, 0, 8, 14, 0, 8, 1048589, 0, 8, 655373, 0, 8, 589837, 0, 8, 524301, 0, 8, 131085, 0, 8, 65549, 0, 8, 13, 0, 8, 1048588, 0, 8, 655372, 0, 8, 589836, 0, 8, 131084, 0, 8, 65548, 0, 8, 12, 0, 8, 1048587, 0, 8, 655371, 0, 8, 589835, 0, 8, 131083, 0, 8, 65547, 0, 8, 11, 0, 8, 1048586, 0, 8, 983050, 0, 8, 917514, 0, 8, 851978, 0, 8, 786442, 0, 8, 720906, 0, 8, 655370, 0, 8, 589834, 0, 8, 131082, 0, 8, 65546, 0, 8, 10, 0, 8, 1048585, 0, 8, 983049, 0, 8, 917513, 0, 8, 851977, 0, 8, 786441, 0, 8, 720905, 0, 8, 655369, 0, 8, 589833, 0, 8, 131081, 0, 8, 65545, 0, 8, 9, 0, 8, 1048584, 0, 8, 983048, 0, 8, 917512, 0, 8, 851976, 0, 8, 786440, 0, 8, 720904, 0, 8, 655368, 0, 8, 589832, 0, 8, 131080, 0, 8, 65544, 0, 8, 8, 0, 8, 1048583, 0, 8, 655367, 0, 8, 589831, 0, 8, 65543, 0, 8, 7, 0, 8, 1048582, 0, 8, 655366, 0, 8, 589830, 0, 8, 65542, 0, 8, 6, 0, 8, 1048581, 0, 8, 655365, 0, 8, 589829, 0, 8, 65541, 0, 8, 5, 0, 8, 1048580, 0, 8, 655364, 0, 8, 589828, 0, 8, 65540, 0, 8, 4, 0, 8, 1048579, 0, 8, 655363, 0, 8, 589827, 0, 8, 65539, 0, 8, 3, 0, 8, 1048578, 0, 8, 983042, 0, 8, 917506, 0, 8, 851970, 0, 8, 786434, 0, 8, 720898, 0, 8, 655362, 0, 8, 589826, 0, 8, 131074, 0, 8, 65538, 0, 8, 2, 0, 8, 1048577, 0, 8, 983041, 0, 8, 917505, 0, 8, 851969, 0, 8, 786433, 0, 8, 720897, 0, 8, 655361, 0, 8, 589825, 0, 8, 524289, 0, 8, 458753, 0, 8, 393217, 0, 8, 327681, 0, 8, 262145, 0, 8, 196609, 0, 8, 131073, 0, 8, 65537, 0, 8, 1, 0, 8, 1048576, 0, 8, 983040, 0, 8, 917504, 0, 8, 851968, 0, 8, 786432, 0, 8, 720896, 0, 8, 655360, 0, 8, 589824, 0, 8, 524288, 0, 8, 458752, 0, 8, 393216, 0, 8, 327680, 0, 8, 262144, 0, 8, 196608, 0, 8, 131072, 0, 8, 65536, 0, 8, 0, 0, 8, 131071, 196608, 3, 65535, 196608, 3, -1, 196608, 4, -65536, 131072, 7, -65535, 131072, 7, 196607, 196608, 3, 262143, 196608, 3, 327679, 196608, 3, 393215, 196608, 3, 458751, 196608, 3, 524287, 196608, 3, 589823, 196608, 3, 655359, 196608, 3, 720895, 196608, 3, 786431, 196608, 3, 851967, 196608, 3, 917503, 196608, 3, 983039, 196608, 3, 1048575, 196608, 3, 1114111, 196608, 3, -65534, 131072, 7, -65533, 131072, 7, -65532, 131072, 7, -65531, 131072, 7, -65530, 131072, 7, -65529, 131072, 7, -65528, 131072, 7, -65527, 131072, 7, -65526, 131072, 7, -65525, 131072, 7, -65524, 131072, 7, -65523, 131072, 7, -65522, 131072, 7, -65521, 131072, 7, -65520, 131072, 7, -65519, 131072, 7, -65518, 131072, 7, -65517, 65536, 4, 524300, 0, 8, 524299, 0, 8, 524298, 0, 8, 458762, 0, 8, 393226, 0, 8, 327690, 0, 8, 262154, 0, 8, 196618, 0, 8, 524297, 0, 8, 458761, 0, 8, 393225, 0, 8, 327689, 0, 8, 262153, 0, 8, 196617, 0, 8, 524296, 0, 8, 458760, 0, 8, 393224, 0, 8, 327688, 0, 8, 262152, 0, 8, 196616, 0, 8, 524295, 0, 8, 524294, 0, 8, 524293, 0, 8, 524292, 0, 8, 524291, 0, 8, 524290, 0, 8, 458754, 0, 8, 393218, 0, 8, 327682, 0, 8, 262146, 0, 8, 196610, 0, 8, 131079, 0, 8, 131078, 0, 8, 131077, 0, 8, 131076, 0, 8, 131075, 0, 8, 1179666, 0, 8, 1114130, 0, 8, 1179665, 0, 8, 1114129, 0, 8, 1179664, 0, 8, 1114128, 0, 8, 1179663, 0, 8, 1114127, 0, 8, 1179662, 0, 8, 1114126, 0, 8, 1179661, 0, 8, 1114125, 0, 8, 1179660, 0, 8, 1114124, 0, 8, 1179659, 0, 8, 1114123, 0, 8, 1179658, 0, 8, 1114122, 0, 8, 1179657, 0, 8, 1114121, 0, 8, 1179656, 0, 8, 1114120, 0, 8, 1179655, 0, 8, 1114119, 0, 8, 1179654, 0, 8, 1114118, 0, 8, 1179653, 0, 8, 1114117, 0, 8, 1179652, 0, 8, 1114116, 0, 8, 1179651, 0, 8, 1114115, 0, 8, 1179650, 0, 8, 1114114, 0, 8, 1179649, 0, 8, 1114113, 0, 8, 1179648, 0, 8, 1114112, 0, 8, 1179647, 196608, 3, 1245183, 196608, 3, 983043, 65536, 7, 983044, 131072, 7, 983045, 131072, 7, 983046, 131072, 7, 983047, 196608, 7, 720899, 65536, 2, 786435, 65536, 3, 851971, 65536, 3, 917507, 65536, 3, 196611, 65536, 2, 262147, 65536, 3, 327683, 65536, 3, 393219, 65536, 3, 458755, 65536, 7, 262151, 196608, 3, 196615, 196608, 2, 327687, 196608, 3, 393223, 196608, 3, 458759, 196608, 7, 196612, 131072, 2, 196613, 131072, 2, 196614, 131072, 2, 458756, 131072, 7, 458757, 131072, 7, 458758, 131072, 7, 720900, 131072, 2, 720901, 131072, 2, 720902, 131072, 2, 720903, 196608, 2, 786439, 196608, 3, 851975, 196608, 3, 917511, 196608, 3, 1245185, 131072, 2, 1245184, 131072, 2, 1310719, 720896, 2, 1245186, 131072, 2, 1245187, 131072, 2, 1245188, 131072, 2, 1245189, 131072, 2, 1245190, 131072, 2, 1245191, 131072, 2, 1245192, 131072, 2, 1245193, 131072, 2, 1245194, 131072, 2, 1245195, 131072, 2, 1245196, 131072, 2, 1245197, 131072, 2, 1245198, 131072, 2, 1245199, 131072, 2, 1245200, 131072, 2, 1245201, 131072, 2, 1245202, 131072, 2, 1245203, 851968, 2, 720907, 65536, 2, 786443, 65536, 3, 851979, 65536, 3, 917515, 65536, 3, 983051, 65536, 7, 196619, 65536, 2, 262155, 65536, 3, 327691, 65536, 3, 393227, 65536, 3, 458763, 65536, 7, 196620, 131072, 2, 196621, 131072, 2, 196622, 131072, 2, 196623, 196608, 2, 262159, 196608, 3, 327695, 196608, 3, 393231, 196608, 3, 458767, 196608, 7, 720911, 196608, 2, 786447, 196608, 3, 851983, 196608, 3, 917519, 196608, 3, 983055, 196608, 7, 458764, 131072, 7, 720908, 131072, 2, 458765, 131072, 7, 720909, 131072, 2, 458766, 131072, 7, 720910, 131072, 2, 983052, 131072, 7, 983053, 131072, 7, 983054, 131072, 7, 19, 65536, 3, 65555, 65536, 3, 131091, 65536, 3, 196627, 65536, 3, 262163, 65536, 3, 327699, 65536, 3, 393235, 65536, 3, 458771, 65536, 3, 524307, 65536, 3, 589843, 65536, 3, 655379, 65536, 3, 720915, 65536, 3, 786451, 65536, 3, 851987, 65536, 3, 917523, 65536, 3, 983059, 65536, 3, 1048595, 65536, 3, 1114131, 65536, 3, 1179667, 65536, 3) script = ExtResource("1_n5qca") -metadata/_edit_vertical_guides_ = [255.0] +metadata/_edit_vertical_guides_ = [48.0] diff --git a/DungeonShooting_Godot/resource/map/tiledata/Room3.json b/DungeonShooting_Godot/resource/map/tiledata/Room3.json index 10fd0cf..9878578 100644 --- a/DungeonShooting_Godot/resource/map/tiledata/Room3.json +++ b/DungeonShooting_Godot/resource/map/tiledata/Room3.json @@ -10,23 +10,33 @@ "DoorAreaInfos": [ { "Direction": 3, - "Start": 16, - "End": 80 + "Start": 64, + "End": 128 }, { "Direction": 2, "Start": 64, - "End": 272 + "End": 128 }, { "Direction": 1, "Start": 16, - "End": 320 + "End": 144 }, { "Direction": 3, "Start": 208, - "End": 320 + "End": 272 + }, + { + "Direction": 2, + "Start": 208, + "End": 272 + }, + { + "Direction": 0, + "Start": 16, + "End": 144 } ] } \ No newline at end of file diff --git a/DungeonShooting_Godot/resource/theme/mainTheme.tres b/DungeonShooting_Godot/resource/theme/mainTheme.tres index 2f76416..3939daa 100644 --- a/DungeonShooting_Godot/resource/theme/mainTheme.tres +++ b/DungeonShooting_Godot/resource/theme/mainTheme.tres @@ -352,7 +352,7 @@ [sub_resource type="ImageTexture" id="58"] -[sub_resource type="Image" id="Image_ru6ow"] +[sub_resource type="Image" id="Image_fp8ys"] data = { "data": PackedByteArray(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 1, 255, 255, 255, 39, 255, 255, 255, 67, 255, 255, 255, 67, 255, 255, 255, 39, 255, 255, 255, 1, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 39, 255, 255, 255, 75, 255, 255, 255, 75, 255, 255, 255, 75, 255, 255, 255, 75, 255, 255, 255, 39, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 66, 255, 255, 255, 75, 255, 255, 255, 75, 255, 255, 255, 75, 255, 255, 255, 75, 255, 255, 255, 66, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 66, 255, 255, 255, 75, 255, 255, 255, 75, 255, 255, 255, 75, 255, 255, 255, 75, 255, 255, 255, 66, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 39, 255, 255, 255, 75, 255, 255, 255, 75, 255, 255, 255, 75, 255, 255, 255, 75, 255, 255, 255, 39, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 1, 255, 255, 255, 39, 255, 255, 255, 67, 255, 255, 255, 67, 255, 255, 255, 39, 255, 255, 255, 1, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), "format": "RGBA8", @@ -362,7 +362,7 @@ } [sub_resource type="ImageTexture" id="60"] -image = SubResource("Image_ru6ow") +image = SubResource("Image_fp8ys") [sub_resource type="StyleBoxTexture" id="61"] content_margin_left = 2.0 @@ -372,7 +372,7 @@ texture = SubResource("60") region_rect = Rect2(0, 0, 12, 12) -[sub_resource type="Image" id="Image_tolgg"] +[sub_resource type="Image" id="Image_ju1v8"] data = { "data": PackedByteArray(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 191, 191, 191, 0, 247, 247, 247, 0, 248, 248, 248, 0, 248, 248, 248, 0, 247, 247, 247, 0, 191, 191, 191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 191, 191, 191, 0, 191, 191, 191, 4, 247, 247, 247, 98, 248, 248, 248, 167, 248, 248, 248, 167, 247, 247, 247, 98, 191, 191, 191, 4, 191, 191, 191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 247, 247, 247, 0, 247, 247, 247, 97, 248, 248, 248, 186, 248, 248, 248, 186, 248, 248, 248, 186, 248, 248, 248, 186, 247, 247, 247, 97, 247, 247, 247, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 248, 248, 248, 0, 248, 248, 248, 164, 248, 248, 248, 186, 248, 248, 248, 186, 248, 248, 248, 186, 248, 248, 248, 186, 248, 248, 248, 164, 248, 248, 248, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 248, 248, 248, 0, 248, 248, 248, 164, 248, 248, 248, 186, 248, 248, 248, 186, 248, 248, 248, 186, 248, 248, 248, 186, 248, 248, 248, 164, 248, 248, 248, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 247, 247, 247, 0, 247, 247, 247, 97, 248, 248, 248, 186, 248, 248, 248, 186, 248, 248, 248, 186, 248, 248, 248, 186, 247, 247, 247, 97, 247, 247, 247, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 191, 191, 191, 0, 191, 191, 191, 4, 247, 247, 247, 98, 248, 248, 248, 167, 248, 248, 248, 167, 247, 247, 247, 98, 191, 191, 191, 4, 191, 191, 191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 191, 191, 191, 0, 247, 247, 247, 0, 248, 248, 248, 0, 248, 248, 248, 0, 247, 247, 247, 0, 191, 191, 191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), "format": "RGBA8", @@ -382,7 +382,7 @@ } [sub_resource type="ImageTexture" id="63"] -image = SubResource("Image_tolgg") +image = SubResource("Image_ju1v8") [sub_resource type="StyleBoxTexture" id="64"] content_margin_left = 2.0 @@ -392,7 +392,7 @@ texture = SubResource("63") region_rect = Rect2(0, 0, 12, 12) -[sub_resource type="Image" id="Image_ikl8y"] +[sub_resource type="Image" id="Image_fwi1t"] data = { "data": PackedByteArray(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 127, 127, 127, 0, 173, 173, 173, 0, 173, 173, 173, 0, 173, 173, 173, 0, 173, 173, 173, 0, 127, 127, 127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 127, 127, 127, 0, 127, 127, 127, 4, 173, 173, 173, 97, 173, 173, 173, 166, 173, 173, 173, 166, 173, 173, 173, 97, 127, 127, 127, 4, 127, 127, 127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 172, 172, 172, 0, 172, 172, 172, 96, 173, 173, 173, 185, 173, 173, 173, 185, 173, 173, 173, 185, 173, 173, 173, 185, 172, 172, 172, 96, 172, 172, 172, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 173, 173, 173, 0, 173, 173, 173, 163, 173, 173, 173, 185, 173, 173, 173, 185, 173, 173, 173, 185, 173, 173, 173, 185, 173, 173, 173, 163, 173, 173, 173, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 173, 173, 173, 0, 173, 173, 173, 163, 173, 173, 173, 185, 173, 173, 173, 185, 173, 173, 173, 185, 173, 173, 173, 185, 173, 173, 173, 163, 173, 173, 173, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 172, 172, 172, 0, 172, 172, 172, 96, 173, 173, 173, 185, 173, 173, 173, 185, 173, 173, 173, 185, 173, 173, 173, 185, 172, 172, 172, 96, 172, 172, 172, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 127, 127, 127, 0, 127, 127, 127, 4, 173, 173, 173, 97, 173, 173, 173, 166, 173, 173, 173, 166, 173, 173, 173, 97, 127, 127, 127, 4, 127, 127, 127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 127, 127, 127, 0, 173, 173, 173, 0, 173, 173, 173, 0, 173, 173, 173, 0, 173, 173, 173, 0, 127, 127, 127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), "format": "RGBA8", @@ -402,7 +402,7 @@ } [sub_resource type="ImageTexture" id="66"] -image = SubResource("Image_ikl8y") +image = SubResource("Image_fwi1t") [sub_resource type="StyleBoxTexture" id="67"] content_margin_left = 2.0 @@ -412,7 +412,7 @@ texture = SubResource("66") region_rect = Rect2(0, 0, 12, 12) -[sub_resource type="Image" id="Image_dr62o"] +[sub_resource type="Image" id="Image_mj55k"] data = { "data": PackedByteArray(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 4, 255, 255, 255, 16, 255, 255, 255, 16, 255, 255, 255, 4, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 16, 255, 255, 255, 21, 255, 255, 255, 21, 255, 255, 255, 16, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 16, 255, 255, 255, 21, 255, 255, 255, 21, 255, 255, 255, 16, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 4, 255, 255, 255, 16, 255, 255, 255, 16, 255, 255, 255, 4, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), "format": "RGBA8", @@ -422,7 +422,7 @@ } [sub_resource type="ImageTexture" id="69"] -image = SubResource("Image_dr62o") +image = SubResource("Image_mj55k") [sub_resource type="StyleBoxTexture" id="70"] content_margin_left = 0.0 @@ -446,7 +446,7 @@ content_margin_right = 4.0 content_margin_bottom = 4.0 -[sub_resource type="Image" id="Image_2p7lp"] +[sub_resource type="Image" id="Image_x6ijx"] data = { "data": PackedByteArray(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 76, 255, 255, 255, 17, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 17, 255, 255, 255, 76, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 76, 255, 255, 255, 228, 255, 255, 255, 188, 255, 255, 255, 17, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 17, 255, 255, 255, 188, 255, 255, 255, 228, 255, 255, 255, 76, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 18, 255, 255, 255, 188, 255, 255, 255, 229, 255, 255, 255, 187, 255, 255, 255, 17, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 17, 255, 255, 255, 187, 255, 255, 255, 229, 255, 255, 255, 188, 255, 255, 255, 18, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 19, 255, 255, 255, 188, 255, 255, 255, 229, 255, 255, 255, 185, 255, 255, 255, 17, 255, 255, 255, 17, 255, 255, 255, 186, 255, 255, 255, 229, 255, 255, 255, 188, 255, 255, 255, 19, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 19, 255, 255, 255, 190, 255, 255, 255, 229, 255, 255, 255, 185, 255, 255, 255, 185, 255, 255, 255, 229, 255, 255, 255, 189, 255, 255, 255, 19, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 19, 255, 255, 255, 191, 255, 255, 255, 229, 255, 255, 255, 229, 255, 255, 255, 190, 255, 255, 255, 19, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 17, 255, 255, 255, 188, 255, 255, 255, 229, 255, 255, 255, 229, 255, 255, 255, 188, 255, 255, 255, 17, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 17, 255, 255, 255, 188, 255, 255, 255, 229, 255, 255, 255, 188, 255, 255, 255, 188, 255, 255, 255, 229, 255, 255, 255, 187, 255, 255, 255, 17, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 17, 255, 255, 255, 187, 255, 255, 255, 229, 255, 255, 255, 188, 255, 255, 255, 18, 255, 255, 255, 19, 255, 255, 255, 188, 255, 255, 255, 229, 255, 255, 255, 186, 255, 255, 255, 17, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 17, 255, 255, 255, 185, 255, 255, 255, 229, 255, 255, 255, 189, 255, 255, 255, 19, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 19, 255, 255, 255, 189, 255, 255, 255, 229, 255, 255, 255, 185, 255, 255, 255, 17, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 76, 255, 255, 255, 229, 255, 255, 255, 190, 255, 255, 255, 19, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 19, 255, 255, 255, 190, 255, 255, 255, 229, 255, 255, 255, 76, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 77, 255, 255, 255, 19, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 19, 255, 255, 255, 77, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), "format": "RGBA8", @@ -456,7 +456,7 @@ } [sub_resource type="ImageTexture" id="56"] -image = SubResource("Image_2p7lp") +image = SubResource("Image_x6ijx") [sub_resource type="StyleBoxFlat" id="57"] content_margin_left = 6.0 diff --git a/DungeonShooting_Godot/src/framework/common/Utils.cs b/DungeonShooting_Godot/src/framework/common/Utils.cs index 631c1d7..31c9455 100644 --- a/DungeonShooting_Godot/src/framework/common/Utils.cs +++ b/DungeonShooting_Godot/src/framework/common/Utils.cs @@ -10,7 +10,7 @@ /// /// 返回随机 boolean 值 /// - public static bool RandBoolean() + public static bool RandomBoolean() { return GD.Randf() >= 0.5f; } @@ -18,7 +18,7 @@ /// /// 返回一个区间内的随机小数 /// - public static float RandfRange(float min, float max) + public static float RandomRangeFloat(float min, float max) { if (min == max) return min; if (min > max) @@ -29,7 +29,7 @@ /// /// 返回一个区间内的随机整数 /// - public static int RandRangeInt(int min, int max) + public static int RandomRangeInt(int min, int max) { if (min == max) return min; if (min > max) @@ -40,29 +40,48 @@ /// /// 随机返回其中一个参数 /// - public static T RandChoose(params T[] list) + public static T RandomChoose(params T[] list) { if (list.Length == 0) { return default; } - return list[RandRangeInt(0, list.Length - 1)]; + return list[RandomRangeInt(0, list.Length - 1)]; } /// /// 随机返回集合中的一个元素 /// - public static T RandChoose(List list) + public static T RandomChoose(List list) { if (list.Count == 0) { return default; } - return list[RandRangeInt(0, list.Count - 1)]; + return list[RandomRangeInt(0, list.Count - 1)]; } + /// + /// 随机返回集合中的一个元素, 并将其从集合中移除 + /// + public static T RandomChooseAndRemove(List list) + { + if (list.Count == 0) + { + return default; + } + + var index = RandomRangeInt(0, list.Count - 1); + var result = list[index]; + list.RemoveAt(index); + return result; + } + + /// + /// 根据四个点计算出矩形 + /// public static Rect2 CalcRect(float start1, float end1, float start2, float end2) { return new Rect2( diff --git a/DungeonShooting_Godot/src/framework/map/GenerateDungeon.cs b/DungeonShooting_Godot/src/framework/map/GenerateDungeon.cs index 204d044..ddc8a4a 100644 --- a/DungeonShooting_Godot/src/framework/map/GenerateDungeon.cs +++ b/DungeonShooting_Godot/src/framework/map/GenerateDungeon.cs @@ -93,8 +93,8 @@ //如果房间数量不够, 就一直生成 while (_count < _maxCount) { - var room = Utils.RandChoose(RoomInfos); - var errorCode = GenerateRoom(room, Utils.RandRangeInt(0, 3), out var nextRoom); + var room = Utils.RandomChoose(RoomInfos); + var errorCode = GenerateRoom(room, Utils.RandomRangeInt(0, 3), out var nextRoom); if (errorCode == GenerateRoomErrorCode.NoError) { _failCount = 0; @@ -129,7 +129,7 @@ } //随机选择一个房间 - var roomSplit = Utils.RandChoose(GameApplication.Instance.RoomConfig); + var roomSplit = Utils.RandomChoose(GameApplication.Instance.RoomConfig); var room = new RoomInfo(_count, roomSplit); //房间大小 @@ -142,17 +142,17 @@ if (prevRoomInfo != null) //表示这不是第一个房间, 就得判断当前位置下的房间是否被遮挡 { //房间间隔 - var space = Utils.RandRangeInt(_roomMinInterval, _roomMaxInterval); + var space = Utils.RandomRangeInt(_roomMinInterval, _roomMaxInterval); //中心偏移 int offset; if (direction == 0 || direction == 2) { - offset = Utils.RandRangeInt(-(int)(prevRoomInfo.Size.X * _roomVerticalMinDispersion), + offset = Utils.RandomRangeInt(-(int)(prevRoomInfo.Size.X * _roomVerticalMinDispersion), (int)(prevRoomInfo.Size.X * _roomVerticalMaxDispersion)); } else { - offset = Utils.RandRangeInt(-(int)(prevRoomInfo.Size.Y * _roomHorizontalMinDispersion), + offset = Utils.RandomRangeInt(-(int)(prevRoomInfo.Size.Y * _roomHorizontalMinDispersion), (int)(prevRoomInfo.Size.Y * _roomHorizontalMaxDispersion)); } @@ -222,11 +222,11 @@ } //这条线有一定概率不生成下一个房间 - if (Utils.RandRangeInt(0, 2) != 0) + if (Utils.RandomRangeInt(0, 2) != 0) { while (dirList.Count > 0) { - var randDir = Utils.RandChoose(dirList); + var randDir = Utils.RandomChoose(dirList); GenerateRoom(room, randDir, out var nextRoom); if (nextRoom == null) { @@ -259,8 +259,8 @@ nextRoomDoor.ConnectRoom = room; nextRoomDoor.ConnectDoor = roomDoor; - - if (Utils.RandBoolean()) + //先寻找直通门 + if (Utils.RandomBoolean()) { //直行通道, 优先横轴 if (TryConnectHorizontalDoor(room, roomDoor, nextRoom, nextRoomDoor) @@ -295,7 +295,7 @@ { if (room.Position.Y > nextRoom.Position.Y) { - if (Utils.RandBoolean()) + if (Utils.RandomBoolean()) { roomDoor.Direction = DoorDirection.N; //↑ nextRoomDoor.Direction = DoorDirection.E; //→ @@ -318,7 +318,7 @@ } else { - if (Utils.RandBoolean()) + if (Utils.RandomBoolean()) { roomDoor.Direction = DoorDirection.S; //↓ nextRoomDoor.Direction = DoorDirection.E; //→ @@ -345,7 +345,7 @@ { if (room.Position.Y > nextRoom.Position.Y) { - if (Utils.RandBoolean()) + if (Utils.RandomBoolean()) { roomDoor.Direction = DoorDirection.E; //→ nextRoomDoor.Direction = DoorDirection.S; //↓ @@ -368,7 +368,7 @@ } else { - if (Utils.RandBoolean()) + if (Utils.RandomBoolean()) { roomDoor.Direction = DoorDirection.E; //→ nextRoomDoor.Direction = DoorDirection.N; //↑ @@ -408,6 +408,9 @@ return true; } + /// + /// 尝试寻找横轴方向上两个房间的连通的门, 只查找直线通道, 返回是否找到 + /// private bool TryConnectHorizontalDoor(RoomInfo room, RoomDoorInfo roomDoor, RoomInfo nextRoom, RoomDoorInfo nextRoomDoor) { var overlapX = Mathf.Min(room.Position.X + room.Size.X, nextRoom.Position.X + nextRoom.Size.X) - @@ -416,45 +419,50 @@ if (overlapX >= 6) { //找到重叠区域 - var range = CalcOverlapRange(room.Position.X, room.Position.X + room.Size.X, - nextRoom.Position.X, nextRoom.Position.X + nextRoom.Size.X); - var x = Utils.RandRangeInt((int)range.X + 1, (int)range.Y - CorridorWidth - 1); - - if (room.Position.Y < nextRoom.Position.Y) //room在上, nextRoom在下 + var rangeList = FindPassage(room, nextRoom, + room.Position.Y < nextRoom.Position.Y ? DoorDirection.S : DoorDirection.N); + + while (rangeList.Count > 0) { - FindPassage(room, nextRoom, DoorDirection.S); + //找到重叠区域 + var range = Utils.RandomChooseAndRemove(rangeList); + var x = Utils.RandomRangeInt(range.X, range.Y); - roomDoor.Direction = DoorDirection.S; - nextRoomDoor.Direction = DoorDirection.N; - roomDoor.OriginPosition = new Vector2(x, room.Position.Y + room.Size.Y); - nextRoomDoor.OriginPosition = new Vector2(x, nextRoom.Position.Y); - } - else //room在下, nextRoom在上 - { - FindPassage(room, nextRoom, DoorDirection.N); - - roomDoor.Direction = DoorDirection.N; - nextRoomDoor.Direction = DoorDirection.S; - roomDoor.OriginPosition = new Vector2(x, room.Position.Y); - nextRoomDoor.OriginPosition = new Vector2(x, nextRoom.Position.Y + nextRoom.Size.Y); - } + if (room.Position.Y < nextRoom.Position.Y) //room在上, nextRoom在下 + { + roomDoor.Direction = DoorDirection.S; + nextRoomDoor.Direction = DoorDirection.N; + roomDoor.OriginPosition = new Vector2(x, room.Position.Y + room.Size.Y); + nextRoomDoor.OriginPosition = new Vector2(x, nextRoom.Position.Y); + } + else //room在下, nextRoom在上 + { + roomDoor.Direction = DoorDirection.N; + nextRoomDoor.Direction = DoorDirection.S; + roomDoor.OriginPosition = new Vector2(x, room.Position.Y); + nextRoomDoor.OriginPosition = new Vector2(x, nextRoom.Position.Y + nextRoom.Size.Y); + } - //判断门之间的通道是否有物体碰到 - if (!AddCorridorToGridRange(roomDoor, nextRoomDoor)) - { - //此门不能连通 - return false; - } + //判断门之间的通道是否有物体碰到 + if (!AddCorridorToGridRange(roomDoor, nextRoomDoor)) + { + //此门不能连通 + continue; + } - //没有撞到物体 - room.Doors.Add(roomDoor); - nextRoom.Doors.Add(nextRoomDoor); - return true; + //没有撞到物体 + room.Doors.Add(roomDoor); + nextRoom.Doors.Add(nextRoomDoor); + return true; + } } return false; } + /// + /// 尝试寻找纵轴方向上两个房间的连通的门, 只查找直线通道, 返回是否找到 + /// private bool TryConnectVerticalDoor(RoomInfo room, RoomDoorInfo roomDoor, RoomInfo nextRoom, RoomDoorInfo nextRoomDoor) { var overlapY = Mathf.Min(room.Position.Y + room.Size.Y, nextRoom.Position.Y + nextRoom.Size.Y) - @@ -463,36 +471,42 @@ if (overlapY >= 6) { //找到重叠区域 - var range = CalcOverlapRange(room.Position.Y, room.Position.Y + room.Size.Y, - nextRoom.Position.Y, nextRoom.Position.Y + nextRoom.Size.Y); - var y = Utils.RandRangeInt((int)range.X + 1, (int)range.Y - CorridorWidth - 1); + var rangeList = FindPassage(room, nextRoom, + room.Position.X < nextRoom.Position.X ? DoorDirection.E : DoorDirection.W); - if (room.Position.X < nextRoom.Position.X) //room在左, nextRoom在右 + while (rangeList.Count > 0) { - roomDoor.Direction = DoorDirection.E; - nextRoomDoor.Direction = DoorDirection.W; - roomDoor.OriginPosition = new Vector2(room.Position.X + room.Size.X, y); - nextRoomDoor.OriginPosition = new Vector2(nextRoom.Position.X, y); - } - else //room在右, nextRoom在左 - { - roomDoor.Direction = DoorDirection.W; - nextRoomDoor.Direction = DoorDirection.E; - roomDoor.OriginPosition = new Vector2(room.Position.X, y); - nextRoomDoor.OriginPosition = new Vector2(nextRoom.Position.X + nextRoom.Size.X, y); - } + //找到重叠区域 + var range = Utils.RandomChooseAndRemove(rangeList); + var y = Utils.RandomRangeInt(range.X, range.Y); + + if (room.Position.X < nextRoom.Position.X) //room在左, nextRoom在右 + { + roomDoor.Direction = DoorDirection.E; + nextRoomDoor.Direction = DoorDirection.W; + roomDoor.OriginPosition = new Vector2(room.Position.X + room.Size.X, y); + nextRoomDoor.OriginPosition = new Vector2(nextRoom.Position.X, y); + } + else //room在右, nextRoom在左 + { + roomDoor.Direction = DoorDirection.W; + nextRoomDoor.Direction = DoorDirection.E; + roomDoor.OriginPosition = new Vector2(room.Position.X, y); + nextRoomDoor.OriginPosition = new Vector2(nextRoom.Position.X + nextRoom.Size.X, y); + } - //判断门之间的通道是否有物体碰到 - if (!AddCorridorToGridRange(roomDoor, nextRoomDoor)) - { - //此门不能连通 - return false; - } + //判断门之间的通道是否有物体碰到 + if (!AddCorridorToGridRange(roomDoor, nextRoomDoor)) + { + //此门不能连通 + continue; + } - //没有撞到物体 - room.Doors.Add(roomDoor); - nextRoom.Doors.Add(nextRoomDoor); - return true; + //没有撞到物体 + room.Doors.Add(roomDoor); + nextRoom.Doors.Add(nextRoomDoor); + return true; + } } return false; @@ -505,13 +519,13 @@ /// 第二个房间 /// 第一个房间连接方向 /// 返回连接的 x/y 轴坐标 - private List FindPassage(RoomInfo room, RoomInfo nextRoom, DoorDirection direction) + private List FindPassage(RoomInfo room, RoomInfo nextRoom, DoorDirection direction) { var room1 = room.RoomSplit.RoomInfo; var room2 = nextRoom.RoomSplit.RoomInfo; //用于存储符合生成条件的区域 - var rangeList = new List(); + var rangeList = new List(); foreach (var doorAreaInfo1 in room1.DoorAreaInfos) { @@ -542,8 +556,7 @@ //交集范围够生成门 if (range.Y - range.X >= CorridorWidth * TileCellSize) { - range.Y -= CorridorWidth * TileCellSize; - rangeList.Add(range); + rangeList.Add(new Vector2I((int)(range.X / 16), (int)(range.Y / 16) - CorridorWidth)); } } } diff --git a/DungeonShooting_Godot/src/game/camera/GameCamera.cs b/DungeonShooting_Godot/src/game/camera/GameCamera.cs index 066f275..8850463 100644 --- a/DungeonShooting_Godot/src/game/camera/GameCamera.cs +++ b/DungeonShooting_Godot/src/game/camera/GameCamera.cs @@ -109,8 +109,8 @@ { var distance = _CalculateDistance(); _shakeOffset += _processDirection + new Vector2( - Utils.RandfRange(-distance.X, distance.X) - _shakeOffset.X, - Utils.RandfRange(-distance.Y, distance.Y) - _shakeOffset.Y + Utils.RandomRangeFloat(-distance.X, distance.X) - _shakeOffset.X, + Utils.RandomRangeFloat(-distance.Y, distance.Y) - _shakeOffset.Y ); _processDistance = Vector2.Zero; _processDirection = Vector2.Zero; diff --git a/DungeonShooting_Godot/src/game/item/weapon/Weapon.cs b/DungeonShooting_Godot/src/game/item/weapon/Weapon.cs index c443557..3988260 100644 --- a/DungeonShooting_Godot/src/game/item/weapon/Weapon.cs +++ b/DungeonShooting_Godot/src/game/item/weapon/Weapon.cs @@ -518,7 +518,7 @@ if (!Attribute.ContinuousShoot) { _continuousCount = - Utils.RandRangeInt(Attribute.MinContinuousCount, Attribute.MaxContinuousCount); + Utils.RandomRangeInt(Attribute.MinContinuousCount, Attribute.MaxContinuousCount); } } @@ -632,12 +632,12 @@ OnFire(); //开火发射的子弹数量 - var bulletCount = Utils.RandRangeInt(Attribute.MaxFireBulletCount, Attribute.MinFireBulletCount); + var bulletCount = Utils.RandomRangeInt(Attribute.MaxFireBulletCount, Attribute.MinFireBulletCount); //武器口角度 var angle = new Vector2(GameConfig.ScatteringDistance, CurrScatteringRange).Angle(); //先算武器口方向 - var tempRotation = Utils.RandfRange(-angle, angle); + var tempRotation = Utils.RandomRangeFloat(-angle, angle); var tempAngle = Mathf.RadToDeg(tempRotation); //开火时枪口角度 @@ -660,7 +660,7 @@ //武器身位置 var max = Mathf.Abs(Mathf.Max(Attribute.MaxBacklash, Attribute.MinBacklash)); _currBacklashLength = Mathf.Clamp( - _currBacklashLength - Utils.RandfRange(Attribute.MinBacklash, Attribute.MaxBacklash), + _currBacklashLength - Utils.RandomRangeFloat(Attribute.MinBacklash, Attribute.MaxBacklash), -max, max ); Position = new Vector2(_currBacklashLength, 0).Rotated(Rotation); @@ -889,8 +889,8 @@ if (flag) { Throw(new Vector2(30, 15), GlobalPosition, 0, 0, - Utils.RandRangeInt(-20, 20), Utils.RandRangeInt(20, 50), - Utils.RandRangeInt(-180, 180)); + Utils.RandomRangeInt(-20, 20), Utils.RandomRangeInt(20, 50), + Utils.RandomRangeInt(-180, 180)); } } else //没有武器 @@ -945,10 +945,10 @@ GlobalRotationDegrees = angle; var startHeight = 6; - var direction = angle + Utils.RandRangeInt(-20, 20); + var direction = angle + Utils.RandomRangeInt(-20, 20); var xf = 20; - var yf = Utils.RandRangeInt(50, 70); - var rotate = Utils.RandRangeInt(-90, 90); + var yf = Utils.RandomRangeInt(50, 70); + var rotate = Utils.RandomRangeInt(-90, 90); Throw(new Vector2(30, 15), startPosition, startHeight, direction, xf, yf, rotate, true); } diff --git a/DungeonShooting_Godot/src/game/item/weapon/gun/Gun.cs b/DungeonShooting_Godot/src/game/item/weapon/gun/Gun.cs index 283c8dd..2416ce3 100644 --- a/DungeonShooting_Godot/src/game/item/weapon/gun/Gun.cs +++ b/DungeonShooting_Godot/src/game/item/weapon/gun/Gun.cs @@ -104,10 +104,10 @@ { //创建一个弹壳 var startHeight = 6; - var direction = GlobalRotationDegrees + Utils.RandRangeInt(-30, 30) + 180; - var xf = Utils.RandRangeInt(20, 60); - var yf = Utils.RandRangeInt(60, 120); - var rotate = Utils.RandRangeInt(-720, 720); + var direction = GlobalRotationDegrees + Utils.RandomRangeInt(-30, 30) + 180; + var xf = Utils.RandomRangeInt(20, 60); + var yf = Utils.RandomRangeInt(60, 120); + var rotate = Utils.RandomRangeInt(-720, 720); var shell = new ShellCase(); shell.Throw(new Vector2(10, 5), Master.GlobalPosition, startHeight, direction, xf, yf, rotate, true); @@ -135,7 +135,7 @@ var bullet = new Bullet( ResourcePath.prefab_weapon_bullet_Bullet_tscn, 350, - Utils.RandfRange(Attribute.MinDistance, Attribute.MaxDistance), + Utils.RandomRangeFloat(Attribute.MinDistance, Attribute.MaxDistance), FirePoint.GlobalPosition, fireRotation, GetAttackLayer() diff --git a/DungeonShooting_Godot/src/game/item/weapon/gun/Shotgun.cs b/DungeonShooting_Godot/src/game/item/weapon/gun/Shotgun.cs index 72ff5ce..8402af5 100644 --- a/DungeonShooting_Godot/src/game/item/weapon/gun/Shotgun.cs +++ b/DungeonShooting_Godot/src/game/item/weapon/gun/Shotgun.cs @@ -64,10 +64,10 @@ //创建一个弹壳 var startPos = GlobalPosition + new Vector2(0, 5); var startHeight = 6; - var direction = GlobalRotationDegrees + Utils.RandRangeInt(-30, 30) + 180; - var xf = Utils.RandRangeInt(20, 60); - var yf = Utils.RandRangeInt(60, 120); - var rotate = Utils.RandRangeInt(-720, 720); + var direction = GlobalRotationDegrees + Utils.RandomRangeInt(-30, 30) + 180; + var xf = Utils.RandomRangeInt(20, 60); + var yf = Utils.RandomRangeInt(60, 120); + var rotate = Utils.RandomRangeInt(-720, 720); var shell = new ShellCase(); shell.Throw(new Vector2(5, 10), startPos, startHeight, direction, xf, yf, rotate, true); @@ -93,10 +93,10 @@ //创建子弹 var bullet = new Bullet( ResourcePath.prefab_weapon_bullet_Bullet_tscn, - Utils.RandRangeInt(280, 380), - Utils.RandfRange(Attribute.MinDistance, Attribute.MaxDistance), + Utils.RandomRangeInt(280, 380), + Utils.RandomRangeFloat(Attribute.MinDistance, Attribute.MaxDistance), FirePoint.GlobalPosition, - fireRotation + Utils.RandfRange(-20 / 180f * Mathf.Pi, 20 / 180f * Mathf.Pi), + fireRotation + Utils.RandomRangeFloat(-20 / 180f * Mathf.Pi, 20 / 180f * Mathf.Pi), GetAttackLayer() ); bullet.PutDown(RoomLayerEnum.YSortLayer); diff --git a/DungeonShooting_Godot/src/game/role/enemy/state/AiNormalState.cs b/DungeonShooting_Godot/src/game/role/enemy/state/AiNormalState.cs index 6089ec9..9e2d574 100644 --- a/DungeonShooting_Godot/src/game/role/enemy/state/AiNormalState.cs +++ b/DungeonShooting_Godot/src/game/role/enemy/state/AiNormalState.cs @@ -79,7 +79,7 @@ { if (Master.NavigationAgent2D.IsNavigationFinished()) //到达终点 { - _pauseTimer = Utils.RandfRange(0.3f, 2f); + _pauseTimer = Utils.RandomRangeFloat(0.3f, 2f); _isMoveOver = true; _moveFlag = false; Master.BasisVelocity = Vector2.Zero; @@ -98,7 +98,7 @@ var lastSlideCollision = Master.GetLastSlideCollision(); if (lastSlideCollision != null && lastSlideCollision.GetCollider() is Role) //碰到其他角色 { - _pauseTimer = Utils.RandfRange(0.1f, 0.5f); + _pauseTimer = Utils.RandomRangeFloat(0.1f, 0.5f); _isMoveOver = true; _moveFlag = false; Master.BasisVelocity = Vector2.Zero; @@ -125,15 +125,15 @@ float angle; if (_againstWall) { - angle = Utils.RandfRange(_againstWallNormalAngle - Mathf.Pi * 0.5f, + angle = Utils.RandomRangeFloat(_againstWallNormalAngle - Mathf.Pi * 0.5f, _againstWallNormalAngle + Mathf.Pi * 0.5f); } else { - angle = Utils.RandfRange(0, Mathf.Pi * 2f); + angle = Utils.RandomRangeFloat(0, Mathf.Pi * 2f); } - var len = Utils.RandRangeInt(30, 200); + var len = Utils.RandomRangeInt(30, 200); _nextPos = new Vector2(len, 0).Rotated(angle) + Master.GlobalPosition; //获取射线碰到的坐标 if (Master.TestViewRayCast(_nextPos)) //碰到墙壁 diff --git a/DungeonShooting_Godot/src/game/role/enemy/state/AiSurroundState.cs b/DungeonShooting_Godot/src/game/role/enemy/state/AiSurroundState.cs index a777251..1c5e18f 100644 --- a/DungeonShooting_Godot/src/game/role/enemy/state/AiSurroundState.cs +++ b/DungeonShooting_Godot/src/game/role/enemy/state/AiSurroundState.cs @@ -81,7 +81,7 @@ { if (Master.NavigationAgent2D.IsNavigationFinished()) //到达终点 { - _pauseTimer = Utils.RandfRange(0f, 0.5f); + _pauseTimer = Utils.RandomRangeFloat(0f, 0.5f); _isMoveOver = true; _moveFlag = false; Master.BasisVelocity = Vector2.Zero; @@ -100,7 +100,7 @@ var lastSlideCollision = Master.GetLastSlideCollision(); if (lastSlideCollision != null && lastSlideCollision.GetCollider() is Role) //碰到其他角色 { - _pauseTimer = Utils.RandfRange(0f, 0.3f); + _pauseTimer = Utils.RandomRangeFloat(0f, 0.3f); _isMoveOver = true; _moveFlag = false; Master.BasisVelocity = Vector2.Zero; @@ -141,8 +141,8 @@ var weapon = Master.Holster.ActiveWeapon; var distance = (int)(weapon == null ? 150 : (weapon.Attribute.MinDistance * 0.7f)); _nextPosition = new Vector2( - targetPos.X + Utils.RandRangeInt(-distance, distance), - targetPos.Y + Utils.RandRangeInt(-distance, distance) + targetPos.X + Utils.RandomRangeInt(-distance, distance), + targetPos.Y + Utils.RandomRangeInt(-distance, distance) ); Master.NavigationAgent2D.TargetPosition = _nextPosition; }