diff --git a/DungeonShooting_Godot/prefab/ui/MapEditor.tscn b/DungeonShooting_Godot/prefab/ui/MapEditor.tscn
index e86a5bc..21ca00a 100644
--- a/DungeonShooting_Godot/prefab/ui/MapEditor.tscn
+++ b/DungeonShooting_Godot/prefab/ui/MapEditor.tscn
@@ -1,4 +1,4 @@
-[gd_scene load_steps=14 format=3 uid="uid://csbxfkdupsckv"]
+[gd_scene load_steps=15 format=3 uid="uid://csbxfkdupsckv"]
[ext_resource type="Script" path="res://src/game/ui/mapEditor/MapEditorPanel.cs" id="1_5s7a0"]
[ext_resource type="Texture2D" uid="uid://cajcnlimvoxk" path="res://resource/sprite/ui/commonIcon/Back.png" id="2_gkcw7"]
@@ -11,6 +11,12 @@
[ext_resource type="PackedScene" uid="uid://bb2ekkpxifd7g" path="res://prefab/ui/MapEditorMapLayer.tscn" id="7_ychtn"]
[ext_resource type="PackedScene" uid="uid://peo0n8bl15y5" path="res://prefab/ui/MapEditorMapMark.tscn" id="8_8tgeu"]
+[sub_resource type="NavigationPolygon" id="NavigationPolygon_oidah"]
+resource_local_to_scene = true
+source_geometry_mode = 1
+source_geometry_group_name = &"navigation"
+cell_size = 4.0
+
[sub_resource type="Animation" id="Animation_o3btm"]
length = 0.001
tracks/0/type = "value"
@@ -192,12 +198,16 @@
size = Vector2i(1334, 1002)
render_target_update_mode = 4
-[node name="TileMap" type="TileMap" parent="Bg/VBoxContainer/HSplitContainer/Left/MarginContainer/MapView/SubViewport"]
+[node name="TileMap" type="TileMap" parent="Bg/VBoxContainer/HSplitContainer/Left/MarginContainer/MapView/SubViewport" groups=["navigation"]]
position = Vector2(500, 540)
scale = Vector2(4, 4)
format = 2
script = ExtResource("4_mhy1a")
+[node name="NavigationRegion" type="NavigationRegion2D" parent="Bg/VBoxContainer/HSplitContainer/Left/MarginContainer/MapView/SubViewport/TileMap"]
+z_index = 10
+navigation_polygon = SubResource("NavigationPolygon_oidah")
+
[node name="ErrorCell" type="Sprite2D" parent="Bg/VBoxContainer/HSplitContainer/Left/MarginContainer/MapView/SubViewport/TileMap"]
visible = false
modulate = Color(1, 0, 0, 0)
diff --git a/DungeonShooting_Godot/project.godot b/DungeonShooting_Godot/project.godot
index 5a61829..8fdcd2e 100644
--- a/DungeonShooting_Godot/project.godot
+++ b/DungeonShooting_Godot/project.godot
@@ -11,7 +11,7 @@
[application]
config/name="DungeonShooting"
-run/main_scene="res://scene/test/TestNewTerrain.tscn"
+run/main_scene="res://scene/Main.tscn"
config/features=PackedStringArray("4.2", "C#")
config/icon="res://icon.png"
@@ -234,6 +234,7 @@
[navigation]
+2d/default_cell_size=4.0
2d/default_edge_connection_margin=4
[physics]
diff --git a/DungeonShooting_Godot/resource/map/tileMaps/GroupConfig.json b/DungeonShooting_Godot/resource/map/tileMaps/GroupConfig.json
index 9daed0e..a4c35ea 100644
--- a/DungeonShooting_Godot/resource/map/tileMaps/GroupConfig.json
+++ b/DungeonShooting_Godot/resource/map/tileMaps/GroupConfig.json
@@ -60,5 +60,31 @@
"ShopList": [],
"EventList": [],
"Remark": "\u6D4B\u8BD5\u7EC4"
+ },
+ "TestGroup2": {
+ "GroupName": "TestGroup2",
+ "BattleList": [
+ {
+ "ErrorType": 0,
+ "Path": "resource/map/tileMaps/TestGroup2/battle/Battle1"
+ }
+ ],
+ "InletList": [
+ {
+ "ErrorType": 0,
+ "Path": "resource/map/tileMaps/TestGroup2/inlet/Start1"
+ }
+ ],
+ "OutletList": [
+ {
+ "ErrorType": 0,
+ "Path": "resource/map/tileMaps/TestGroup2/outlet/End1"
+ }
+ ],
+ "BossList": [],
+ "RewardList": [],
+ "ShopList": [],
+ "EventList": [],
+ "Remark": ""
}
}
\ No newline at end of file
diff --git a/DungeonShooting_Godot/resource/map/tileMaps/TestGroup2/battle/Battle1/Preinstall.json b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup2/battle/Battle1/Preinstall.json
new file mode 100644
index 0000000..638cd69
--- /dev/null
+++ b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup2/battle/Battle1/Preinstall.json
@@ -0,0 +1 @@
+[{"Name":"Preinstall1","Weight":100,"Remark":"","WaveList":[[]]}]
\ No newline at end of file
diff --git a/DungeonShooting_Godot/resource/map/tileMaps/TestGroup2/battle/Battle1/Preview.png b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup2/battle/Battle1/Preview.png
new file mode 100644
index 0000000..e011869
--- /dev/null
+++ 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/Preview.png.import b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup2/battle/Battle1/Preview.png.import
new file mode 100644
index 0000000..0e1c680
--- /dev/null
+++ b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup2/battle/Battle1/Preview.png.import
@@ -0,0 +1,34 @@
+[remap]
+
+importer="texture"
+type="CompressedTexture2D"
+uid="uid://cf1kqsml1cl5i"
+path="res://.godot/imported/Preview.png-3ef522440049d103a5f16d9ca7538f66.ctex"
+metadata={
+"vram_texture": false
+}
+
+[deps]
+
+source_file="res://resource/map/tileMaps/TestGroup2/battle/Battle1/Preview.png"
+dest_files=["res://.godot/imported/Preview.png-3ef522440049d103a5f16d9ca7538f66.ctex"]
+
+[params]
+
+compress/mode=0
+compress/high_quality=false
+compress/lossy_quality=0.7
+compress/hdr_compression=1
+compress/normal_map=0
+compress/channel_pack=0
+mipmaps/generate=false
+mipmaps/limit=-1
+roughness/mode=0
+roughness/src_normal=""
+process/fix_alpha_border=true
+process/premult_alpha=false
+process/normal_map_invert_y=false
+process/hdr_as_srgb=false
+process/hdr_clamp_exposure=false
+process/size_limit=0
+detect_3d/compress_to=1
diff --git a/DungeonShooting_Godot/resource/map/tileMaps/TestGroup2/battle/Battle1/RoomInfo.json b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup2/battle/Battle1/RoomInfo.json
new file mode 100644
index 0000000..21874ff
--- /dev/null
+++ b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup2/battle/Battle1/RoomInfo.json
@@ -0,0 +1 @@
+{"Position":{"X":-4,"Y":-4},"Size":{"X":10,"Y":8},"DoorAreaInfos":[],"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
new file mode 100644
index 0000000..6dd2be8
--- /dev/null
+++ b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup2/battle/Battle1/TileInfo.json
@@ -0,0 +1 @@
+{"NavigationList":[{"Type":0,"Points":[-40,-40,72,-40,72,48,-40,48]},{"Type":1,"Points":[-8,-16,40,-16,40,24,-8,24]}],"Floor":[-3,-3,0,0,8,-3,-2,0,0,8,-3,-1,0,0,8,-3,0,0,0,8,-3,1,0,0,8,-3,2,0,0,8,-2,-3,0,0,8,-2,-2,0,0,8,-2,-1,0,0,8,-2,0,0,0,8,-2,1,0,0,8,-2,2,0,0,8,-1,-3,0,0,8,-1,-2,0,0,8,-1,-1,0,0,8,-1,0,0,0,8,-1,1,0,0,8,-1,2,0,0,8,0,-3,0,0,8,0,-2,0,0,8,0,1,0,0,8,0,2,0,0,8,1,-3,0,0,8,1,-2,0,0,8,1,1,0,0,8,1,2,0,0,8,2,-3,0,0,8,2,-2,0,0,8,2,-1,0,0,8,2,0,0,0,8,2,1,0,0,8,2,2,0,0,8,3,-3,0,0,8,3,-2,0,0,8,3,-1,0,0,8,3,0,0,0,8,3,1,0,0,8,3,2,0,0,8,4,-3,0,0,8,4,-2,0,0,8,4,-1,0,0,8,4,0,0,0,8,4,1,0,0,8,4,2,0,0,8],"Middle":[-3,-4,0,2,7,-2,-4,0,2,7,-1,-4,0,2,7,0,-4,0,2,7,0,0,0,1,7,1,-4,0,2,7,1,0,0,3,7,2,-4,0,2,7,3,-4,0,2,7,4,-4,0,2,7],"Top":[-4,-4,0,3,4,-4,-3,0,3,3,-4,-2,0,3,3,-4,-1,0,3,3,-4,0,0,3,3,-4,1,0,3,3,-4,2,0,3,3,-4,3,0,11,2,-3,3,0,2,2,-2,3,0,2,2,-1,3,0,2,2,0,-1,0,1,2,0,3,0,2,2,1,-1,0,3,2,1,3,0,2,2,2,3,0,2,2,3,3,0,2,2,4,3,0,2,2,5,-4,0,1,4,5,-3,0,1,3,5,-2,0,1,3,5,-1,0,1,3,5,0,0,1,3,5,1,0,1,3,5,2,0,1,3,5,3,0,13,2]}
\ No newline at end of file
diff --git a/DungeonShooting_Godot/resource/map/tileMaps/TestGroup2/inlet/Start1/Preinstall.json b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup2/inlet/Start1/Preinstall.json
new file mode 100644
index 0000000..91e06bf
--- /dev/null
+++ b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup2/inlet/Start1/Preinstall.json
@@ -0,0 +1 @@
+[{"Name":"Preinstall1","Weight":100,"Remark":"","WaveList":[[{"Position":{"X":63,"Y":19},"Size":{"X":21,"Y":14},"SpecialMarkType":1,"DelayTime":0,"MarkList":[]}]]}]
\ No newline at end of file
diff --git a/DungeonShooting_Godot/resource/map/tileMaps/TestGroup2/inlet/Start1/Preview.png b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup2/inlet/Start1/Preview.png
new file mode 100644
index 0000000..08c0866
--- /dev/null
+++ b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup2/inlet/Start1/Preview.png
Binary files differ
diff --git a/DungeonShooting_Godot/resource/map/tileMaps/TestGroup2/inlet/Start1/Preview.png.import b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup2/inlet/Start1/Preview.png.import
new file mode 100644
index 0000000..27efd0e
--- /dev/null
+++ b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup2/inlet/Start1/Preview.png.import
@@ -0,0 +1,34 @@
+[remap]
+
+importer="texture"
+type="CompressedTexture2D"
+uid="uid://cjxxh0x4pi25b"
+path="res://.godot/imported/Preview.png-35f18254ad0a5399ae1abd4e5c3653da.ctex"
+metadata={
+"vram_texture": false
+}
+
+[deps]
+
+source_file="res://resource/map/tileMaps/TestGroup2/inlet/Start1/Preview.png"
+dest_files=["res://.godot/imported/Preview.png-35f18254ad0a5399ae1abd4e5c3653da.ctex"]
+
+[params]
+
+compress/mode=0
+compress/high_quality=false
+compress/lossy_quality=0.7
+compress/hdr_compression=1
+compress/normal_map=0
+compress/channel_pack=0
+mipmaps/generate=false
+mipmaps/limit=-1
+roughness/mode=0
+roughness/src_normal=""
+process/fix_alpha_border=true
+process/premult_alpha=false
+process/normal_map_invert_y=false
+process/hdr_as_srgb=false
+process/hdr_clamp_exposure=false
+process/size_limit=0
+detect_3d/compress_to=1
diff --git a/DungeonShooting_Godot/resource/map/tileMaps/TestGroup2/inlet/Start1/RoomInfo.json b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup2/inlet/Start1/RoomInfo.json
new file mode 100644
index 0000000..537291c
--- /dev/null
+++ b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup2/inlet/Start1/RoomInfo.json
@@ -0,0 +1 @@
+{"Position":{"X":-4,"Y":-5},"Size":{"X":14,"Y":13},"DoorAreaInfos":[{"Direction":0,"Start":32,"End":96},{"Direction":2,"Start":16,"End":160},{"Direction":1,"Start":48,"End":112},{"Direction":3,"Start":48,"End":160}],"GroupName":"TestGroup2","RoomType":1,"RoomName":"Start1","Weight":100,"Remark":""}
\ No newline at end of file
diff --git a/DungeonShooting_Godot/resource/map/tileMaps/TestGroup2/inlet/Start1/TileInfo.json b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup2/inlet/Start1/TileInfo.json
new file mode 100644
index 0000000..ff9bf33
--- /dev/null
+++ b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup2/inlet/Start1/TileInfo.json
@@ -0,0 +1 @@
+{"NavigationList":[],"Floor":[0,-2,0,0,4,0,-1,0,0,4,0,0,0,0,4,0,1,0,0,4,1,1,0,0,4,2,1,0,0,4,3,1,0,0,4,4,1,0,0,4,5,1,0,0,4,5,-3,0,0,4,5,-2,0,0,4,5,-1,0,0,4,5,0,0,0,4,3,-3,0,0,4,4,-2,0,0,4,4,-1,0,0,4,4,0,0,0,4,3,0,0,0,4,2,0,0,0,4,1,0,0,0,4,3,-2,0,0,4,3,-1,0,0,4,1,-2,0,0,4,2,-1,0,0,4,1,-1,0,0,4,1,2,0,0,4,2,2,0,0,4,4,2,0,0,4,5,2,0,0,4,6,2,0,0,4,7,2,0,0,4,3,2,0,0,4,0,2,0,0,4,-1,2,0,0,4,-2,2,0,0,4,-3,2,0,0,4,-2,3,0,0,4,-1,3,0,0,4,0,3,0,0,4,0,4,0,0,4,1,4,0,0,4,2,4,0,0,4,3,4,0,0,4,4,4,0,0,4,5,4,0,0,4,6,4,0,0,4,7,4,0,0,4,7,3,0,0,4,6,3,0,0,4,5,3,0,0,4,4,3,0,0,4,3,3,0,0,4,2,3,0,0,4,1,3,0,0,4,-2,4,0,0,4,-1,4,0,0,4,7,5,0,0,4,6,5,0,0,4,5,5,0,0,4,4,5,0,0,4,3,5,0,0,4,2,5,0,0,4,1,5,0,0,4,0,5,0,0,4,-1,5,0,0,4,-2,5,0,0,4,-2,6,0,0,4,-1,6,0,0,4,0,6,0,0,4,1,6,0,0,4,2,6,0,0,4,3,6,0,0,4,4,6,0,0,4,5,6,0,0,4,6,6,0,0,4,6,-3,0,0,4,6,-2,0,0,4,6,-1,0,0,4,6,0,0,0,4,6,1,0,0,4,2,-2,0,0,4,7,-2,0,0,4,7,-1,0,0,4,7,0,0,0,4,7,1,0,0,4,8,1,0,0,4,8,0,0,0,4,8,-1,0,0,4,8,-2,0,0,4,7,-3,0,0,4,4,-3,0,0,4,-1,1,0,0,4,-2,1,0,0,4,-3,1,0,0,4,-3,0,0,0,4,-2,0,0,0,4,-1,0,0,0,4,-1,-1,0,0,4,-2,-1,0,0,4,-3,-1,0,0,4,-1,-2,0,0,4,8,-3,0,0,4],"Middle":[],"Top":[-4,-5,0,9,2,-4,-4,0,9,2,-4,-3,0,6,2,-4,-2,0,11,2,-4,-1,0,11,2,-4,0,0,11,2,-4,1,0,11,2,-4,2,0,11,2,-4,3,0,6,1,-4,4,0,9,2,-4,5,0,9,2,-4,6,0,9,2,-4,7,0,9,2,-3,-5,0,9,2,-3,-4,0,9,2,-3,-3,0,9,3,-3,-2,0,2,4,-3,3,0,11,0,-3,4,0,11,2,-3,5,0,11,2,-3,6,0,11,2,-3,7,0,6,1,-2,-5,0,9,2,-2,-4,0,6,2,-2,-3,0,11,3,-2,-2,0,3,4,-2,7,0,10,0,-1,-5,0,9,2,-1,-4,0,9,3,-1,-3,0,2,4,-1,7,0,10,0,0,-5,0,9,2,0,-4,0,9,3,0,-3,0,2,4,0,7,0,10,0,1,-5,0,9,2,1,-4,0,9,3,1,-3,0,2,4,1,7,0,10,0,2,-5,0,6,2,2,-4,0,11,3,2,-3,0,3,4,2,7,0,10,0,3,-5,0,9,3,3,-4,0,2,4,3,7,0,10,0,4,-5,0,9,3,4,-4,0,2,4,4,7,0,10,0,5,-5,0,9,3,5,-4,0,2,4,5,7,0,10,0,6,-5,0,9,3,6,-4,0,2,4,6,7,0,10,0,7,-5,0,9,3,7,-4,0,2,4,7,6,0,8,0,7,7,0,5,1,8,-5,0,9,3,8,-4,0,2,4,8,2,0,8,0,8,3,0,8,1,8,4,0,8,1,8,5,0,8,1,8,6,0,5,1,8,7,0,9,2,9,-5,0,5,2,9,-4,0,8,1,9,-3,0,8,1,9,-2,0,8,1,9,-1,0,8,1,9,0,0,8,1,9,1,0,8,1,9,2,0,5,1,9,3,0,9,2,9,4,0,9,2,9,5,0,9,2,9,6,0,9,2,9,7,0,9,2]}
\ No newline at end of file
diff --git a/DungeonShooting_Godot/resource/map/tileMaps/TestGroup2/outlet/End1/Preinstall.json b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup2/outlet/End1/Preinstall.json
new file mode 100644
index 0000000..638cd69
--- /dev/null
+++ b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup2/outlet/End1/Preinstall.json
@@ -0,0 +1 @@
+[{"Name":"Preinstall1","Weight":100,"Remark":"","WaveList":[[]]}]
\ No newline at end of file
diff --git a/DungeonShooting_Godot/resource/map/tileMaps/TestGroup2/outlet/End1/Preview.png b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup2/outlet/End1/Preview.png
new file mode 100644
index 0000000..981dc0f
--- /dev/null
+++ b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup2/outlet/End1/Preview.png
Binary files differ
diff --git a/DungeonShooting_Godot/resource/map/tileMaps/TestGroup2/outlet/End1/Preview.png.import b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup2/outlet/End1/Preview.png.import
new file mode 100644
index 0000000..2c5717b
--- /dev/null
+++ b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup2/outlet/End1/Preview.png.import
@@ -0,0 +1,34 @@
+[remap]
+
+importer="texture"
+type="CompressedTexture2D"
+uid="uid://1qlrv4iw6tv4"
+path="res://.godot/imported/Preview.png-d8f775a7aa85742ef468e4c3e218196f.ctex"
+metadata={
+"vram_texture": false
+}
+
+[deps]
+
+source_file="res://resource/map/tileMaps/TestGroup2/outlet/End1/Preview.png"
+dest_files=["res://.godot/imported/Preview.png-d8f775a7aa85742ef468e4c3e218196f.ctex"]
+
+[params]
+
+compress/mode=0
+compress/high_quality=false
+compress/lossy_quality=0.7
+compress/hdr_compression=1
+compress/normal_map=0
+compress/channel_pack=0
+mipmaps/generate=false
+mipmaps/limit=-1
+roughness/mode=0
+roughness/src_normal=""
+process/fix_alpha_border=true
+process/premult_alpha=false
+process/normal_map_invert_y=false
+process/hdr_as_srgb=false
+process/hdr_clamp_exposure=false
+process/size_limit=0
+detect_3d/compress_to=1
diff --git a/DungeonShooting_Godot/resource/map/tileMaps/TestGroup2/outlet/End1/RoomInfo.json b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup2/outlet/End1/RoomInfo.json
new file mode 100644
index 0000000..d5051f7
--- /dev/null
+++ b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup2/outlet/End1/RoomInfo.json
@@ -0,0 +1 @@
+{"Position":{"X":-4,"Y":-2},"Size":{"X":8,"Y":7},"DoorAreaInfos":[],"GroupName":"TestGroup2","RoomType":2,"RoomName":"End1","Weight":100,"Remark":""}
\ No newline at end of file
diff --git a/DungeonShooting_Godot/resource/map/tileMaps/TestGroup2/outlet/End1/TileInfo.json b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup2/outlet/End1/TileInfo.json
new file mode 100644
index 0000000..400aefd
--- /dev/null
+++ b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup2/outlet/End1/TileInfo.json
@@ -0,0 +1 @@
+{"NavigationList":[{"Type":0,"Points":[-40,-8,40,-8,40,64,-40,64]}],"Floor":[-3,-1,0,0,8,-3,0,0,0,8,-3,1,0,0,8,-3,2,0,0,8,-3,3,0,0,8,-2,-1,0,0,8,-2,0,0,0,8,-2,1,0,0,8,-2,2,0,0,8,-2,3,0,0,8,-1,-1,0,0,8,-1,0,0,0,8,-1,1,0,0,8,-1,2,0,0,8,-1,3,0,0,8,0,-1,0,0,8,0,0,0,0,8,0,1,0,0,8,0,2,0,0,8,0,3,0,0,8,1,-1,0,0,8,1,0,0,0,8,1,1,0,0,8,1,2,0,0,8,1,3,0,0,8,2,-1,0,0,8,2,0,0,0,8,2,1,0,0,8,2,2,0,0,8,2,3,0,0,8],"Middle":[-3,-2,0,2,7,-2,-2,0,2,7,-1,-2,0,2,7,0,-2,0,2,7,1,-2,0,2,7,2,-2,0,2,7],"Top":[-4,-2,0,3,4,-4,-1,0,3,3,-4,0,0,3,3,-4,1,0,3,3,-4,2,0,3,3,-4,3,0,3,3,-4,4,0,11,2,-3,4,0,2,2,-2,4,0,2,2,-1,4,0,2,2,0,4,0,2,2,1,4,0,2,2,2,4,0,2,2,3,-2,0,1,4,3,-1,0,1,3,3,0,0,1,3,3,1,0,1,3,3,2,0,1,3,3,3,0,1,3,3,4,0,13,2]}
\ No newline at end of file
diff --git a/DungeonShooting_Godot/scene/test/TestNewTerrain.tscn b/DungeonShooting_Godot/scene/test/TestNewTerrain.tscn
index cb6bc28..4439dfb 100644
--- a/DungeonShooting_Godot/scene/test/TestNewTerrain.tscn
+++ b/DungeonShooting_Godot/scene/test/TestNewTerrain.tscn
@@ -13,4 +13,4 @@
format = 2
layer_0/tile_data = PackedInt32Array(1769510, 720896, 3, 1703974, 720896, 2, 1638438, 720896, 2, 1572902, 720896, 2, 1507366, 720896, 2, 1441830, 720896, 2, 1376294, 720896, 2, 1310758, 720896, 2, 1245222, 720896, 2, 1179686, 720896, 2, 1114150, 720896, 2, 1048614, 720896, 2, 983078, 720896, 2, 917542, 720896, 2, 852006, 720896, 2, 786470, 720896, 2, 1769509, 589824, 3, 1703973, 589824, 2, 1638437, 589824, 2, 1572901, 589824, 2, 1507365, 589824, 2, 1441829, 589824, 2, 1376293, 589824, 2, 1310757, 589824, 2, 1245221, 589824, 2, 1179685, 589824, 2, 1114149, 589824, 2, 1048613, 589824, 2, 983077, 589824, 2, 917541, 589824, 2, 852005, 589824, 2, 786469, 589824, 2, 1769508, 589824, 3, 1703972, 589824, 2, 1638436, 589824, 2, 1572900, 589824, 2, 1507364, 589824, 2, 1441828, 589824, 2, 1376292, 589824, 2, 1310756, 589824, 2, 1245220, 589824, 2, 1179684, 589824, 2, 1114148, 589824, 2, 1048612, 589824, 2, 983076, 589824, 2, 917540, 589824, 2, 852004, 589824, 2, 786468, 589824, 2, 1769507, 589824, 3, 1703971, 589824, 2, 1638435, 589824, 2, 1572899, 589824, 2, 1507363, 589824, 2, 1441827, 589824, 2, 1376291, 589824, 2, 1310755, 589824, 2, 1245219, 589824, 2, 1179683, 589824, 2, 1114147, 589824, 2, 1048611, 589824, 2, 983075, 589824, 2, 917539, 589824, 2, 852003, 589824, 2, 786467, 589824, 2, 1769506, 589824, 3, 1703970, 589824, 2, 1638434, 589824, 2, 1572898, 589824, 2, 1507362, 589824, 2, 1441826, 589824, 2, 1376290, 589824, 2, 1310754, 589824, 2, 1245218, 327680, 1, 1179682, 524288, 1, 1114146, 524288, 1, 1048610, 524288, 1, 983074, 327680, 2, 917538, 589824, 2, 852002, 589824, 2, 786466, 589824, 2, 1769505, 589824, 3, 1703969, 589824, 2, 1638433, 589824, 2, 1572897, 589824, 2, 1507361, 589824, 2, 1441825, 589824, 2, 1376289, 589824, 2, 1310753, 589824, 2, 1245217, 655360, 0, 983073, 589824, 3, 917537, 589824, 2, 852001, 589824, 2, 786465, 589824, 2, 1769504, 589824, 3, 1703968, 589824, 2, 1638432, 589824, 2, 1572896, 589824, 2, 1507360, 589824, 2, 1441824, 589824, 2, 1376288, 589824, 2, 1310752, 589824, 2, 1245216, 655360, 0, 983072, 589824, 3, 917536, 589824, 2, 852000, 589824, 2, 786464, 589824, 2, 1769503, 589824, 3, 1703967, 589824, 2, 1638431, 589824, 2, 1572895, 589824, 2, 1507359, 327680, 1, 1441823, 524288, 1, 1376287, 524288, 1, 1310751, 524288, 1, 1245215, 524288, 0, 983071, 589824, 3, 917535, 589824, 2, 851999, 589824, 2, 786463, 589824, 2, 1769502, 589824, 3, 1703966, 589824, 2, 1638430, 589824, 2, 1572894, 589824, 2, 1507358, 655360, 0, 983070, 327680, 3, 851998, 524288, 1, 786462, 327680, 2, 1769501, 589824, 3, 1703965, 589824, 2, 1638429, 589824, 2, 1572893, 327680, 1, 1507357, 524288, 0, 983069, 131072, 3, 786461, 589824, 3, 1769500, 589824, 3, 1703964, 589824, 2, 1638428, 327680, 1, 1572892, 524288, 0, 983068, 131072, 3, 786460, 589824, 3, 1769499, 589824, 3, 1703963, 589824, 2, 1638427, 655360, 0, 1376283, 196608, 3, 983067, 131072, 3, 786459, 589824, 3, 1769498, 589824, 3, 1703962, 589824, 2, 1638426, 655360, 0, 1376282, 131072, 2, 983066, 131072, 3, 786458, 589824, 3, 1769497, 589824, 3, 1703961, 589824, 2, 1638425, 393216, 1, 1572889, 720896, 0, 1376281, 65536, 3, 983065, 65536, 3, 786457, 589824, 3, 1769496, 589824, 3, 1703960, 589824, 2, 1638424, 589824, 2, 1572888, 655360, 0, 786456, 589824, 3, 1769495, 589824, 3, 1703959, 589824, 2, 1638423, 589824, 2, 1572887, 393216, 1, 1507351, 720896, 0, 983063, 720896, 3, 917527, 720896, 2, 851991, 720896, 2, 786455, 393216, 2, 1769494, 589824, 3, 1703958, 589824, 2, 1638422, 589824, 2, 1572886, 589824, 2, 1507350, 655360, 0, 983062, 589824, 3, 917526, 589824, 2, 851990, 589824, 2, 786454, 589824, 2, 1769493, 589824, 3, 1703957, 589824, 2, 1638421, 589824, 2, 1572885, 589824, 2, 1507349, 655360, 0, 983061, 589824, 3, 917525, 589824, 2, 851989, 589824, 2, 786453, 589824, 2, 1769492, 589824, 3, 1703956, 589824, 2, 1638420, 589824, 2, 1572884, 589824, 2, 1507348, 393216, 1, 1441812, 720896, 2, 1376276, 720896, 2, 1310740, 720896, 0, 983060, 589824, 3, 917524, 589824, 2, 851988, 589824, 2, 786452, 589824, 2, 1769491, 589824, 3, 1703955, 589824, 2, 1638419, 589824, 2, 1572883, 589824, 2, 1507347, 589824, 2, 1441811, 589824, 2, 1376275, 589824, 2, 1310739, 393216, 1, 1245203, 720896, 0, 1048595, 720896, 3, 983059, 393216, 2, 917523, 589824, 2, 851987, 589824, 2, 786451, 589824, 2, 1769490, 589824, 3, 1703954, 589824, 2, 1638418, 589824, 2, 1572882, 589824, 2, 1507346, 589824, 2, 1441810, 589824, 2, 1376274, 589824, 2, 1310738, 589824, 2, 1245202, 655360, 0, 1048594, 589824, 3, 983058, 589824, 2, 917522, 589824, 2, 851986, 589824, 2, 786450, 589824, 2, 1769489, 589824, 3, 1703953, 589824, 2, 1638417, 589824, 2, 1572881, 589824, 2, 1507345, 589824, 2, 1441809, 589824, 2, 1376273, 589824, 2, 1310737, 589824, 2, 1245201, 655360, 0, 1048593, 589824, 3, 983057, 589824, 2, 917521, 589824, 2, 851985, 589824, 2, 786449, 589824, 2, 1769488, 589824, 3, 1703952, 589824, 2, 1638416, 589824, 2, 1572880, 589824, 2, 1507344, 589824, 2, 1441808, 589824, 2, 1376272, 589824, 2, 1310736, 589824, 2, 1245200, 655360, 0, 1048592, 589824, 3, 983056, 589824, 2, 917520, 589824, 2, 851984, 589824, 2, 786448, 589824, 2, 1769487, 589824, 3, 1703951, 589824, 2, 1638415, 589824, 2, 1572879, 589824, 2, 1507343, 589824, 2, 1441807, 589824, 2, 1376271, 589824, 2, 1310735, 589824, 2, 1245199, 393216, 1, 1179663, 720896, 2, 1114127, 720896, 2, 1048591, 393216, 2, 983055, 589824, 2, 917519, 589824, 2, 851983, 589824, 2, 786447, 589824, 2, 1769486, 589824, 3, 1703950, 589824, 2, 1638414, 589824, 2, 1572878, 589824, 2, 1507342, 589824, 2, 1441806, 589824, 2, 1376270, 589824, 2, 1310734, 589824, 2, 1245198, 589824, 2, 1179662, 589824, 2, 1114126, 589824, 2, 1048590, 589824, 2, 983054, 589824, 2, 917518, 589824, 2, 851982, 589824, 2, 786446, 589824, 2, 1769485, 589824, 3, 1703949, 589824, 2, 1638413, 589824, 2, 1572877, 589824, 2, 1507341, 589824, 2, 1441805, 589824, 2, 1376269, 589824, 2, 1310733, 589824, 2, 1245197, 589824, 2, 1179661, 589824, 2, 1114125, 589824, 2, 1048589, 589824, 2, 983053, 589824, 2, 917517, 589824, 2, 851981, 589824, 2, 786445, 589824, 2, 1769484, 524288, 3, 1703948, 524288, 1, 1638412, 524288, 1, 1572876, 524288, 1, 1507340, 524288, 1, 1441804, 524288, 1, 1376268, 524288, 1, 1310732, 524288, 1, 1245196, 524288, 1, 1179660, 524288, 1, 1114124, 524288, 1, 1048588, 524288, 1, 983052, 524288, 1, 917516, 524288, 1, 851980, 524288, 1, 786444, 524288, 1, 720934, 720896, 2, 655398, 720896, 2, 589862, 720896, 0, 720933, 589824, 2, 655397, 589824, 2, 589861, 655360, 0, 720932, 589824, 2, 655396, 589824, 2, 589860, 655360, 0, 720931, 589824, 2, 655395, 589824, 2, 589859, 655360, 0, 720930, 589824, 2, 655394, 589824, 2, 589858, 655360, 0, 720929, 589824, 2, 655393, 589824, 2, 589857, 655360, 0, 720928, 589824, 2, 655392, 589824, 2, 589856, 655360, 0, 720927, 589824, 2, 655391, 589824, 2, 589855, 655360, 0, 720926, 589824, 2, 655390, 589824, 2, 589854, 655360, 0, 720925, 589824, 2, 655389, 589824, 2, 589853, 655360, 0, 720924, 589824, 2, 655388, 589824, 2, 589852, 655360, 0, 720923, 589824, 2, 655387, 589824, 2, 589851, 655360, 0, 720922, 589824, 2, 655386, 589824, 2, 589850, 655360, 0, 720921, 589824, 2, 655385, 589824, 2, 589849, 655360, 0, 720920, 589824, 2, 655384, 589824, 2, 589848, 655360, 0, 720919, 589824, 2, 655383, 589824, 2, 589847, 655360, 0, 720918, 589824, 2, 655382, 589824, 2, 589846, 655360, 0, 720917, 589824, 2, 655381, 589824, 2, 589845, 655360, 0, 720916, 589824, 2, 655380, 589824, 2, 589844, 655360, 0, 720915, 589824, 2, 655379, 589824, 2, 589843, 655360, 0, 720914, 589824, 2, 655378, 589824, 2, 589842, 655360, 0, 720913, 589824, 2, 655377, 589824, 2, 589841, 655360, 0, 720912, 589824, 2, 655376, 589824, 2, 589840, 655360, 0, 720911, 589824, 2, 655375, 589824, 2, 589839, 655360, 0, 720910, 589824, 2, 655374, 589824, 2, 589838, 655360, 0, 720909, 589824, 2, 655373, 589824, 2, 589837, 655360, 0, 720908, 524288, 1, 655372, 524288, 1, 589836, 524288, 0, 1114128, 131072, 4, 1114129, 131072, 4, 1114130, 131072, 4, 1114131, 196608, 4, 1048609, 131072, 4, 1048608, 131072, 4, 1048607, 131072, 4, 1048606, 131072, 4, 1048605, 131072, 4, 1048604, 131072, 4, 1048603, 131072, 4, 1048602, 131072, 4, 1048601, 65536, 4, 851993, 131072, 4, 851994, 131072, 4, 851995, 131072, 4, 851996, 131072, 4, 851997, 131072, 4, 917534, 524288, 1, 1048596, 131072, 4, 1048597, 131072, 4, 1048598, 131072, 4, 1048599, 196608, 4, 851992, 131072, 4, 1441817, 65536, 4, 1441818, 131072, 4, 1441819, 196608, 4, 1179671, 0, 3, 1245207, 262144, 4, 1310746, 0, 0, 1310742, 0, 4, 1245206, 0, 4, 1179670, 0, 4, 1114134, 0, 4, 1114133, 0, 4, 1114132, 0, 4, 1179668, 0, 4, 1179667, 0, 4, 1179666, 0, 4, 1179665, 0, 4, 1179664, 0, 4, 1245204, 0, 4, 1245205, 0, 4, 1179669, 0, 4, 1310741, 0, 4, 1376277, 0, 4, 1441813, 0, 4, 1441814, 0, 4, 1376278, 0, 4, 1376279, 0, 4, 1310743, 0, 4, 1310744, 0, 4, 1245208, 0, 4, 1179672, 0, 4, 1114136, 0, 4, 1048600, 0, 4, 983064, 0, 4, 917528, 0, 4, 917529, 0, 4, 917530, 0, 4, 917531, 0, 4, 917532, 0, 4, 917533, 0, 4, 1114135, 0, 4, 1114137, 0, 4, 1179673, 0, 4, 1245209, 0, 4, 1310745, 0, 4, 1245210, 0, 4, 1179674, 0, 4, 1114138, 0, 4, 1114139, 0, 4, 1179675, 0, 4, 1245211, 0, 4, 1310747, 0, 4, 1310748, 0, 4, 1245212, 0, 4, 1179676, 0, 4, 1114140, 0, 4, 1114141, 0, 4, 1179677, 0, 4, 1245213, 0, 4, 1310749, 0, 4, 1376285, 0, 4, 1376284, 0, 4, 1441820, 0, 4, 1507356, 0, 4, 1507355, 0, 4, 1507354, 0, 4, 1507353, 0, 4, 1507352, 0, 4, 1441816, 0, 4, 1376280, 0, 4, 1441815, 0, 4, 1572890, 0, 4, 1572891, 0, 4, 1441821, 0, 4, 1441822, 0, 4, 1376286, 0, 4, 1310750, 0, 4, 1245214, 0, 4, 1179678, 0, 4, 1114142, 0, 4, 1114143, 0, 4, 1179679, 0, 4, 1179680, 0, 4, 1114144, 0, 4, 1114145, 0, 4, 1179681, 0, 4)
-[node name="NavigationRegion2D" type="NavigationRegion2D" parent="."]
+[node name="NavigationRegion2D" type="NavigationRegion2D" parent="TileMap2"]
diff --git a/DungeonShooting_Godot/src/framework/InfiniteGrid.cs b/DungeonShooting_Godot/src/framework/InfiniteGrid.cs
index 09b986f..20ff181 100644
--- a/DungeonShooting_Godot/src/framework/InfiniteGrid.cs
+++ b/DungeonShooting_Godot/src/framework/InfiniteGrid.cs
@@ -10,7 +10,7 @@
///
/// 遍历网格数据回调
///
- public delegate void EachGridCallback(int x, int y, T data);
+ public delegate bool EachGridCallback(int x, int y, T data);
private readonly Dictionary> _map = new Dictionary>();
@@ -191,7 +191,7 @@
}
///
- /// 遍历网格数据
+ /// 遍历网格数据, 回调返回 false 则停止遍历
///
public void ForEach(EachGridCallback cb)
{
@@ -199,7 +199,10 @@
{
foreach (var pair2 in pair1.Value)
{
- cb(pair1.Key, pair2.Key, pair2.Value);
+ if (!cb(pair1.Key, pair2.Key, pair2.Value))
+ {
+ return;
+ }
}
}
}
diff --git a/DungeonShooting_Godot/src/framework/map/DungeonTileMap.cs b/DungeonShooting_Godot/src/framework/map/DungeonTileMap.cs
index 48f1b01..3ac2b44 100644
--- a/DungeonShooting_Godot/src/framework/map/DungeonTileMap.cs
+++ b/DungeonShooting_Godot/src/framework/map/DungeonTileMap.cs
@@ -394,6 +394,7 @@
x2 = Mathf.Max(x2, gx);
y = Mathf.Min(y, gy);
y2 = Mathf.Max(y2, gy);
+ return true;
});
//创建image, 这里留两个像素宽高用于描边
var image = Image.Create(x2 - x + 3, y2 - y + 3, false, Image.Format.Rgba8);
@@ -403,6 +404,7 @@
var posX = gx - x + 1;
var posY = gy - y + 1;
image.SetPixel(posX, posY, new Color(0, 0, 0, 0.5882353F));
+ return true;
});
//创建texture
var imageTexture = ImageTexture.CreateFromImage(image);
@@ -436,7 +438,7 @@
var flag1 = _tileRoot.GetCellSourceId(GameConfig.FloorMapLayer, pos) != -1 ||
_tileRoot.GetCellSourceId(GameConfig.MiddleMapLayer, pos) != -1 ||
_tileRoot.GetCellSourceId(GameConfig.AisleFloorMapLayer, pos) != -1 ||
- (_tileRoot.GetCellSourceId(GameConfig.TopMapLayer, pos) != -1 && _tileRoot.GetCellAtlasCoords(GameConfig.TopMapLayer, pos) != tileCellData.AutoTileCoord);
+ (_tileRoot.GetCellSourceId(GameConfig.TopMapLayer, pos) != -1 && _tileRoot.GetCellAtlasCoords(GameConfig.TopMapLayer, pos) != tileCellData.AutoTileCoords);
if (!flag1) //空地
{
var posDown = new Vector2I(pos.X, pos.Y + 1);
@@ -451,39 +453,39 @@
var flag2 = _tileRoot.GetCellSourceId(GameConfig.FloorMapLayer, posDown) != -1 ||
_tileRoot.GetCellSourceId(GameConfig.MiddleMapLayer, posDown) != -1 ||
- (_tileRoot.GetCellSourceId(GameConfig.TopMapLayer, posDown) != -1 && _tileRoot.GetCellAtlasCoords(GameConfig.TopMapLayer, posDown) != tileCellData.AutoTileCoord) ||
+ (_tileRoot.GetCellSourceId(GameConfig.TopMapLayer, posDown) != -1 && _tileRoot.GetCellAtlasCoords(GameConfig.TopMapLayer, posDown) != tileCellData.AutoTileCoords) ||
_tileRoot.GetCellSourceId(GameConfig.FloorMapLayer, posTop) != -1 ||
_tileRoot.GetCellSourceId(GameConfig.MiddleMapLayer, posTop) != -1 ||
- (_tileRoot.GetCellSourceId(GameConfig.TopMapLayer, posTop) != -1 && _tileRoot.GetCellAtlasCoords(GameConfig.TopMapLayer, posTop) != tileCellData.AutoTileCoord) ||
+ (_tileRoot.GetCellSourceId(GameConfig.TopMapLayer, posTop) != -1 && _tileRoot.GetCellAtlasCoords(GameConfig.TopMapLayer, posTop) != tileCellData.AutoTileCoords) ||
_tileRoot.GetCellSourceId(GameConfig.FloorMapLayer, posLeft) != -1 ||
_tileRoot.GetCellSourceId(GameConfig.MiddleMapLayer, posLeft) != -1 ||
- (_tileRoot.GetCellSourceId(GameConfig.TopMapLayer, posLeft) != -1 && _tileRoot.GetCellAtlasCoords(GameConfig.TopMapLayer, posLeft) != tileCellData.AutoTileCoord) ||
+ (_tileRoot.GetCellSourceId(GameConfig.TopMapLayer, posLeft) != -1 && _tileRoot.GetCellAtlasCoords(GameConfig.TopMapLayer, posLeft) != tileCellData.AutoTileCoords) ||
_tileRoot.GetCellSourceId(GameConfig.FloorMapLayer, posRight) != -1 ||
_tileRoot.GetCellSourceId(GameConfig.MiddleMapLayer, posRight) != -1 ||
- (_tileRoot.GetCellSourceId(GameConfig.TopMapLayer, posRight) != -1 && _tileRoot.GetCellAtlasCoords(GameConfig.TopMapLayer, posRight) != tileCellData.AutoTileCoord) ||
+ (_tileRoot.GetCellSourceId(GameConfig.TopMapLayer, posRight) != -1 && _tileRoot.GetCellAtlasCoords(GameConfig.TopMapLayer, posRight) != tileCellData.AutoTileCoords) ||
//
_tileRoot.GetCellSourceId(GameConfig.FloorMapLayer, posLD) != -1 ||
_tileRoot.GetCellSourceId(GameConfig.MiddleMapLayer, posLD) != -1 ||
- (_tileRoot.GetCellSourceId(GameConfig.TopMapLayer, posLD) != -1 && _tileRoot.GetCellAtlasCoords(GameConfig.TopMapLayer, posLD) != tileCellData.AutoTileCoord) ||
+ (_tileRoot.GetCellSourceId(GameConfig.TopMapLayer, posLD) != -1 && _tileRoot.GetCellAtlasCoords(GameConfig.TopMapLayer, posLD) != tileCellData.AutoTileCoords) ||
_tileRoot.GetCellSourceId(GameConfig.FloorMapLayer, posLT) != -1 ||
_tileRoot.GetCellSourceId(GameConfig.MiddleMapLayer, posLT) != -1 ||
- (_tileRoot.GetCellSourceId(GameConfig.TopMapLayer, posLT) != -1 && _tileRoot.GetCellAtlasCoords(GameConfig.TopMapLayer, posLT) != tileCellData.AutoTileCoord) ||
+ (_tileRoot.GetCellSourceId(GameConfig.TopMapLayer, posLT) != -1 && _tileRoot.GetCellAtlasCoords(GameConfig.TopMapLayer, posLT) != tileCellData.AutoTileCoords) ||
_tileRoot.GetCellSourceId(GameConfig.FloorMapLayer, posRD) != -1 ||
_tileRoot.GetCellSourceId(GameConfig.MiddleMapLayer, posRD) != -1 ||
- (_tileRoot.GetCellSourceId(GameConfig.TopMapLayer, posRD) != -1 && _tileRoot.GetCellAtlasCoords(GameConfig.TopMapLayer, posRD) != tileCellData.AutoTileCoord) ||
+ (_tileRoot.GetCellSourceId(GameConfig.TopMapLayer, posRD) != -1 && _tileRoot.GetCellAtlasCoords(GameConfig.TopMapLayer, posRD) != tileCellData.AutoTileCoords) ||
_tileRoot.GetCellSourceId(GameConfig.FloorMapLayer, posRT) != -1 ||
_tileRoot.GetCellSourceId(GameConfig.MiddleMapLayer, posRT) != -1 ||
- (_tileRoot.GetCellSourceId(GameConfig.TopMapLayer, posRT) != -1 && _tileRoot.GetCellAtlasCoords(GameConfig.TopMapLayer, posRT) != tileCellData.AutoTileCoord);
+ (_tileRoot.GetCellSourceId(GameConfig.TopMapLayer, posRT) != -1 && _tileRoot.GetCellAtlasCoords(GameConfig.TopMapLayer, posRT) != tileCellData.AutoTileCoords);
if (flag2) //非空地, 那么说明这个点需要填充 WALL_BLOCK
{
- _tileRoot.SetCell(GameConfig.TopMapLayer, pos, tileCellData.Id, tileCellData.AutoTileCoord);
+ _tileRoot.SetCell(GameConfig.TopMapLayer, pos, tileCellData.SourceId, tileCellData.AutoTileCoords);
}
}
}
@@ -502,7 +504,7 @@
{
_tempAisleFloorGrid.Set(p, true);
}
- _tileRoot.SetCell(layer, p, 0, data.AutoTileCoord);
+ _tileRoot.SetCell(layer, p, 0, data.AutoTileCoords);
}
}
}
diff --git a/DungeonShooting_Godot/src/framework/map/TileCellData.cs b/DungeonShooting_Godot/src/framework/map/TileCellData.cs
index 8a6f991..156da53 100644
--- a/DungeonShooting_Godot/src/framework/map/TileCellData.cs
+++ b/DungeonShooting_Godot/src/framework/map/TileCellData.cs
@@ -6,19 +6,19 @@
///
public class TileCellData
{
- public TileCellData(int id, Vector2I autoTileCoord)
+ public TileCellData(int sourceId, Vector2I autoTileCoords)
{
- Id = id;
- AutoTileCoord = autoTileCoord;
+ SourceId = sourceId;
+ AutoTileCoords = autoTileCoords;
}
///
/// 在TileSet中的图块id, 也就是sourceId
///
- public int Id;
+ public int SourceId;
///
/// 如果是图块集, 该属性就表示在图块集的位置
///
- public Vector2I AutoTileCoord;
+ public Vector2I AutoTileCoords;
}
\ No newline at end of file
diff --git a/DungeonShooting_Godot/src/framework/map/fog/FogMask.cs b/DungeonShooting_Godot/src/framework/map/fog/FogMask.cs
index e2061fb..c25df57 100644
--- a/DungeonShooting_Godot/src/framework/map/fog/FogMask.cs
+++ b/DungeonShooting_Godot/src/framework/map/fog/FogMask.cs
@@ -110,7 +110,7 @@
{
var tileMap = GameApplication.Instance.World.TileRoot;
var autoConfig = GameApplication.Instance.DungeonManager.AutoTileConfig;
- var wallCoord = autoConfig.WALL_BLOCK.AutoTileCoord;
+ var wallCoord = autoConfig.WALL_BLOCK.AutoTileCoords;
var (x, y) = position;
var (width, height) = size;
x -= 1;
diff --git a/DungeonShooting_Godot/src/framework/map/image/RoomStaticSprite.cs b/DungeonShooting_Godot/src/framework/map/image/RoomStaticSprite.cs
index e3ab686..43a47cb 100644
--- a/DungeonShooting_Godot/src/framework/map/image/RoomStaticSprite.cs
+++ b/DungeonShooting_Godot/src/framework/map/image/RoomStaticSprite.cs
@@ -45,6 +45,7 @@
spriteData.Destroy();
}
data.Clear();
+ return true;
});
_grid.Clear();
QueueFree();
diff --git a/DungeonShooting_Godot/src/game/GameConfig.cs b/DungeonShooting_Godot/src/game/GameConfig.cs
index c116698..e493dae 100644
--- a/DungeonShooting_Godot/src/game/GameConfig.cs
+++ b/DungeonShooting_Godot/src/game/GameConfig.cs
@@ -87,4 +87,9 @@
/// 迷雾过渡时间
///
public const float FogTransitionTime = 0.3f;
+
+ ///
+ /// 导航网格代理收缩半径
+ ///
+ public const float NavigationAgentRadius = 6f;
}
\ No newline at end of file
diff --git a/DungeonShooting_Godot/src/game/manager/ResourcePath.cs b/DungeonShooting_Godot/src/game/manager/ResourcePath.cs
index 707171f..3d3700a 100644
--- a/DungeonShooting_Godot/src/game/manager/ResourcePath.cs
+++ b/DungeonShooting_Godot/src/game/manager/ResourcePath.cs
@@ -427,8 +427,11 @@
public const string resource_tileSet_TileSet_old_tres = "res://resource/tileSet/TileSet_old.tres";
public const string resource_tileSet_map1_TileSet1_tres = "res://resource/tileSet/map1/TileSet1.tres";
public const string resource_tileSet_map1_website_txt = "res://resource/tileSet/map1/website.txt";
+ public const string resource_tileSet_map2_TileSet2_tres = "res://resource/tileSet/map2/TileSet2.tres";
+ public const string resource_tileSprite_TerrainMask_png = "res://resource/tileSprite/TerrainMask.png";
public const string resource_tileSprite_map1_16x16dungeoniiwallreconfigv04spritesheet_png = "res://resource/tileSprite/map1/16x16 dungeon ii wall reconfig v04 spritesheet.png";
public const string resource_tileSprite_map2_DungeonTilesetSpikes_png = "res://resource/tileSprite/map2/Dungeon Tileset + Spikes.png";
+ public const string resource_tileSprite_map2_DungeonTileset_png = "res://resource/tileSprite/map2/Dungeon Tileset.png";
public const string scene_Main_tscn = "res://scene/Main.tscn";
public const string scene_World_tscn = "res://scene/World.tscn";
public const string scene_test_TestCreateSector_tscn = "res://scene/test/TestCreateSector.tscn";
@@ -438,6 +441,7 @@
public const string scene_test_TestMask2_tscn = "res://scene/test/TestMask2.tscn";
public const string scene_test_TestNavigation2_tscn = "res://scene/test/TestNavigation2.tscn";
public const string scene_test_TestNavigationPolygon_tscn = "res://scene/test/TestNavigationPolygon.tscn";
+ public const string scene_test_TestNewTerrain_tscn = "res://scene/test/TestNewTerrain.tscn";
public const string scene_test_TestNewTileMap_tscn = "res://scene/test/TestNewTileMap.tscn";
public const string scene_test_TestOptimizeSprite_tscn = "res://scene/test/TestOptimizeSprite.tscn";
public const string scene_test_TestOutline_tscn = "res://scene/test/TestOutline.tscn";
diff --git a/DungeonShooting_Godot/src/game/room/AutoTileConfig.cs b/DungeonShooting_Godot/src/game/room/AutoTileConfig.cs
index 64b8469..d294245 100644
--- a/DungeonShooting_Godot/src/game/room/AutoTileConfig.cs
+++ b/DungeonShooting_Godot/src/game/room/AutoTileConfig.cs
@@ -61,4 +61,18 @@
return layer;
}
+
+ //-----------------------------------------------------------
+
+ public TileCellData Floor2 = new TileCellData(0, new Vector2I(0, 4));
+ public TileCellData TopMask = new TileCellData(0, new Vector2I(9, 2));
+ public TileCellData WallLeft = new TileCellData(0, new Vector2I(1, 4));
+ public TileCellData WallCenter = new TileCellData(0, new Vector2I(2, 4));
+ public TileCellData WallRight = new TileCellData(0, new Vector2I(3, 4));
+ public TileCellData WallSingle = new TileCellData(0, new Vector2I(4, 4));
+
+ public int GetLayer2(Vector2I atlasCoords)
+ {
+ return atlasCoords == Floor2.AutoTileCoords ? GameConfig.FloorMapLayer : GameConfig.TopMapLayer;
+ }
}
\ No newline at end of file
diff --git a/DungeonShooting_Godot/src/game/ui/mapEditor/MapEditor.cs b/DungeonShooting_Godot/src/game/ui/mapEditor/MapEditor.cs
index 00fd921..a347165 100644
--- a/DungeonShooting_Godot/src/game/ui/mapEditor/MapEditor.cs
+++ b/DungeonShooting_Godot/src/game/ui/mapEditor/MapEditor.cs
@@ -164,6 +164,15 @@
}
///
+ /// 类型: , 路径: MapEditor.Bg.VBoxContainer.HSplitContainer.Left.MarginContainer.MapView.SubViewport.TileMap.NavigationRegion
+ ///
+ public class NavigationRegion : UiNode
+ {
+ public NavigationRegion(MapEditorPanel uiPanel, Godot.NavigationRegion2D node) : base(uiPanel, node) { }
+ public override NavigationRegion Clone() => new (UiPanel, (Godot.NavigationRegion2D)Instance.Duplicate());
+ }
+
+ ///
/// 类型: , 路径: MapEditor.Bg.VBoxContainer.HSplitContainer.Left.MarginContainer.MapView.SubViewport.TileMap.ErrorCell.ErrorCellAnimationPlayer
///
public class ErrorCellAnimationPlayer : UiNode
@@ -209,6 +218,19 @@
public class TileMap : UiNode
{
///
+ /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditor.Bg.VBoxContainer.HSplitContainer.Left.MarginContainer.MapView.SubViewport.NavigationRegion
+ ///
+ public NavigationRegion L_NavigationRegion
+ {
+ get
+ {
+ if (_L_NavigationRegion == null) _L_NavigationRegion = new NavigationRegion(UiPanel, Instance.GetNode("NavigationRegion"));
+ return _L_NavigationRegion;
+ }
+ }
+ private NavigationRegion _L_NavigationRegion;
+
+ ///
/// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditor.Bg.VBoxContainer.HSplitContainer.Left.MarginContainer.MapView.SubViewport.ErrorCell
///
public ErrorCell L_ErrorCell
@@ -678,6 +700,11 @@
public Head S_Head => L_Bg.L_VBoxContainer.L_Head;
///
+ /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditor.Bg.VBoxContainer.HSplitContainer.Left.MarginContainer.MapView.SubViewport.TileMap.NavigationRegion
+ ///
+ public NavigationRegion S_NavigationRegion => L_Bg.L_VBoxContainer.L_HSplitContainer.L_Left.L_MarginContainer.L_MapView.L_SubViewport.L_TileMap.L_NavigationRegion;
+
+ ///
/// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditor.Bg.VBoxContainer.HSplitContainer.Left.MarginContainer.MapView.SubViewport.TileMap.ErrorCell.ErrorCellAnimationPlayer
///
public ErrorCellAnimationPlayer S_ErrorCellAnimationPlayer => L_Bg.L_VBoxContainer.L_HSplitContainer.L_Left.L_MarginContainer.L_MapView.L_SubViewport.L_TileMap.L_ErrorCell.L_ErrorCellAnimationPlayer;
diff --git a/DungeonShooting_Godot/src/game/ui/mapEditor/MapEditorPanel.cs b/DungeonShooting_Godot/src/game/ui/mapEditor/MapEditorPanel.cs
index e8f332e..43823a9 100644
--- a/DungeonShooting_Godot/src/game/ui/mapEditor/MapEditorPanel.cs
+++ b/DungeonShooting_Godot/src/game/ui/mapEditor/MapEditorPanel.cs
@@ -27,9 +27,10 @@
public override void OnCreateUi()
{
//临时处理, 加载TileSet
- var tileSet = ResourceManager.Load(ResourcePath.resource_tileSet_map1_TileSet1_tres);
- var tileSetAtlasSource = (TileSetAtlasSource)tileSet.GetSource(0);
- tileSetAtlasSource.Texture = ImageTexture.CreateFromImage(Image.LoadFromFile("resource/tileSprite/map1/16x16 dungeon ii wall reconfig v04 spritesheet.png"));
+ var tileSet = ResourceManager.Load(ResourcePath.resource_tileSet_map2_TileSet2_tres);
+ //var tileSet = ResourceManager.Load(ResourcePath.resource_tileSet_map1_TileSet1_tres);
+ //var tileSetAtlasSource = (TileSetAtlasSource)tileSet.GetSource(0);
+ //tileSetAtlasSource.Texture = ImageTexture.CreateFromImage(Image.LoadFromFile("resource/tileSprite/map1/16x16 dungeon ii wall reconfig v04 spritesheet.png"));
S_TileMap.Instance.TileSet = tileSet;
S_TabContainer.Instance.SetTabTitle(0, "对象");
@@ -216,10 +217,6 @@
{
return new CheckResult(true, RoomErrorType.Empty);
}
- else if (editorTileMap.HasTerrainError) //地图绘制错误
- {
- return new CheckResult(true, RoomErrorType.TileError);
- }
if (editorTileMap.CurrDoorConfigs.Count > 0)
{
diff --git a/DungeonShooting_Godot/src/game/ui/mapEditor/tileView/EditorTileMap.cs b/DungeonShooting_Godot/src/game/ui/mapEditor/tileView/EditorTileMap.cs
index a904716..9a8793c 100644
--- a/DungeonShooting_Godot/src/game/ui/mapEditor/tileView/EditorTileMap.cs
+++ b/DungeonShooting_Godot/src/game/ui/mapEditor/tileView/EditorTileMap.cs
@@ -98,8 +98,6 @@
private bool _drawFullRect = false;
//负责存储自动图块数据
private InfiniteGrid _autoCellLayerGrid = new InfiniteGrid();
- //用于生成导航网格
- private DungeonTileMap _dungeonTileMap;
//停止绘制多久后开始执行生成操作
private float _generateInterval = 3f;
//生成自动图块和导航网格的计时器
@@ -110,6 +108,8 @@
private Vector2I _checkTerrainErrorPosition = Vector2I.Zero;
//是否执行生成地形成功
private bool _isGenerateTerrain = true;
+ //导航网格数据
+ private Vector2[][] _polygonData;
private bool _initLayer = false;
//--------- 配置数据 -------------
@@ -167,6 +167,9 @@
_eventFactory.AddEventListener(EventEnum.OnEditorDirty, OnEditorDirty);
RenderingServer.FramePostDraw += OnFramePostDraw;
+ var navigationRegion = _editorTileMap.L_NavigationRegion.Instance;
+ navigationRegion.NavigationPolygon.AgentRadius = GameConfig.NavigationAgentRadius;
+ navigationRegion.BakeFinished += OnBakeFinished;
}
public void OnDestroy()
@@ -277,15 +280,13 @@
canvasItem.DrawRect(new Rect2(CurrRoomPosition * size, CurrRoomSize * size),
Colors.Aqua, false, 5f / Scale.X);
}
-
- if (_checkTerrainFlag) //已经通过地形检测
+
+ //绘制导航网格
+ if (_checkTerrainFlag && _isGenerateTerrain && _polygonData != null)
{
- //绘制导航网格
- var result = _dungeonTileMap.GetGenerateNavigationResult();
- if (result != null && result.Success)
+ foreach (var vector2s in _polygonData)
{
- var polygonData = _dungeonTileMap.GetPolygonData();
- Utils.DrawNavigationPolygon(canvasItem, polygonData, 3f / Scale.X);
+ canvasItem.DrawPolygon(vector2s, new Color(0,1,1, 0.3f).MakeArray(vector2s.Length));
}
}
@@ -401,13 +402,9 @@
Debug.Log("开始检测是否可以生成地形...");
if (CheckTerrain())
{
- Debug.Log("开始绘制导航网格...");
- if (GenerateNavigation())
- {
- Debug.Log("开始绘制自动贴图...");
- GenerateTerrain();
- _isGenerateTerrain = true;
- }
+ Debug.Log("开始绘制自动贴图...");
+ GenerateTerrain();
+ _isGenerateTerrain = true;
}
else
{
@@ -499,9 +496,6 @@
SetLayerDataFromList(AutoFloorLayer, tileInfo.Floor);
SetLayerDataFromList(AutoMiddleLayer, tileInfo.Middle);
SetLayerDataFromList(AutoTopLayer, tileInfo.Top);
-
- //导航网格数据
- _dungeonTileMap.SetPolygonData(tileInfo.NavigationList);
//如果有图块错误, 则找出错误的点位
if (roomSplit.ErrorType == RoomErrorType.TileError)
@@ -542,9 +536,6 @@
SetLayerZIndex(AutoTopLayer, AutoTopLayer);
AddLayer(CustomTopLayer);
SetLayerZIndex(CustomTopLayer, CustomTopLayer);
-
- _dungeonTileMap = new DungeonTileMap(this);
- _dungeonTileMap.SetFloorAtlasCoords(new List(new []{ _autoTileConfig.Floor.AutoTileCoord }));
}
//缩小
@@ -574,7 +565,9 @@
//绘制单个自动贴图
private void SetSingleAutoCell(Vector2I position)
{
- SetCell(GetFloorLayer(), position, _sourceId, _autoTileConfig.Floor.AutoTileCoord);
+ var tileCellData = _autoTileConfig.Floor2;
+ SetCell(GetFloorLayer(), position, tileCellData.SourceId, tileCellData.AutoTileCoords);
+ //SetCell(GetFloorLayer(), position, _sourceId, _autoTileConfig.Floor.AutoTileCoords);
if (!_autoCellLayerGrid.Contains(position.X, position.Y))
{
ResetGenerateTimer();
@@ -606,7 +599,8 @@
{
for (var j = 0; j < height; j++)
{
- SetCell(GetFloorLayer(), new Vector2I(start.X + i, start.Y + j), _sourceId, _autoTileConfig.Floor.AutoTileCoord);
+ var tileCellData = _autoTileConfig.Floor2;
+ SetCell(GetFloorLayer(), new Vector2I(start.X + i, start.Y + j), tileCellData.SourceId, tileCellData.AutoTileCoords);
}
}
@@ -658,9 +652,10 @@
{
_generateTimer = _generateInterval;
_isGenerateTerrain = false;
- _dungeonTileMap.ClearPolygonData();
+ _editorTileMap.L_NavigationRegion.Instance.Visible = false;
ClearLayer(AutoTopLayer);
ClearLayer(AutoMiddleLayer);
+ CloseErrorCell();
//标记有修改数据
EventManager.EmitEvent(EventEnum.OnEditorDirty);
}
@@ -676,81 +671,130 @@
//检测是否有不合规的图块, 返回true表示图块正常
private bool CheckTerrain()
{
- var x = CurrRoomPosition.X;
- var y = CurrRoomPosition.Y;
- var w = CurrRoomSize.X;
- var h = CurrRoomSize.Y;
-
- for (var i = 0; i < w; i++)
+ _checkTerrainFlag = true;
+ _autoCellLayerGrid.ForEach((x, y, flag) =>
{
- for (var j = 0; j < h; j++)
+ if (flag)
{
- var pos = new Vector2I(x + i, y + j);
- if (GetCellSourceId(AutoFloorLayer, pos) == -1)
+ if (!_autoCellLayerGrid.Contains(x, y + 1) && _autoCellLayerGrid.Contains(x, y + 2))
{
- //先检测对边是否有地板
- if ((_autoCellLayerGrid.Get(pos.X - 1, pos.Y) && _autoCellLayerGrid.Get(pos.X + 1, pos.Y)) //left & right
- || (_autoCellLayerGrid.Get(pos.X, pos.Y + 1) && _autoCellLayerGrid.Get(pos.X, pos.Y - 1))) //top & down
- {
- _checkTerrainFlag = false;
- _checkTerrainErrorPosition = pos;
- return false;
- }
-
- //再检测对角是否有地板
- var topLeft = _autoCellLayerGrid.Get(pos.X - 1, pos.Y + 1); //top-left
- var downRight = _autoCellLayerGrid.Get(pos.X + 1, pos.Y - 1); //down-right
- var downLeft = _autoCellLayerGrid.Get(pos.X - 1, pos.Y - 1); //down-left
- var topRight = _autoCellLayerGrid.Get(pos.X + 1, pos.Y + 1); //top-right
- if ((topLeft && downRight && !downLeft && !topRight) || (!topLeft && !downRight && downLeft && topRight))
- {
- _checkTerrainFlag = false;
- _checkTerrainErrorPosition = pos;
- return false;
- }
+ _checkTerrainFlag = false;
+ _checkTerrainErrorPosition = new Vector2I(x, y + 1);
+ return false;
}
}
- }
- _checkTerrainFlag = true;
- return true;
+ return true;
+ });
+ return _checkTerrainFlag;
}
//生成自动图块 (地形)
private void GenerateTerrain()
{
- ClearLayer(AutoFloorLayer);
-
+ //ClearLayer(AutoFloorLayer);
var list = new List();
- _autoCellLayerGrid.ForEach((x, y, data) =>
+ var xStart = int.MaxValue;
+ var yStart = int.MaxValue;
+ var xEnd = int.MinValue;
+ var yEnd = int.MinValue;
+
+ _autoCellLayerGrid.ForEach((x, y, flag) =>
{
- if (data)
+ if (flag)
{
- list.Add(new Vector2I(x, y));
+ //计算范围
+ if (x < xStart)
+ xStart = x;
+ else if (x > xEnd)
+ xEnd = x;
+
+ if (y < yStart)
+ yStart = y;
+ else if (y > yEnd)
+ yEnd = y;
+
+ //填充墙壁
+ if (!_autoCellLayerGrid.Contains(x, y - 1))
+ {
+ var left = _autoCellLayerGrid.Contains(x - 1, y - 1);
+ var right = _autoCellLayerGrid.Contains(x + 1, y - 1);
+ TileCellData tileCellData;
+ if (left && right)
+ {
+ tileCellData = _autoTileConfig.WallSingle;
+ }
+ else if (left)
+ {
+ tileCellData = _autoTileConfig.WallLeft;
+ }
+ else if (right)
+ {
+ tileCellData = _autoTileConfig.WallRight;
+ }
+ else
+ {
+ tileCellData = _autoTileConfig.WallCenter;
+ }
+ SetCell(GetFloorLayer(), new Vector2I(x, y - 1), tileCellData.SourceId, tileCellData.AutoTileCoords);
+ }
}
+
+ return true;
});
+
+ //绘制临时边界
+ var pos = new List();
+ for (var x = xStart - 2; x <= xEnd + 2; x++)
+ {
+ var p1 = new Vector2I(x, yStart - 3);
+ var p2 = new Vector2I(x, yEnd + 2);
+ pos.Add(p1);
+ pos.Add(p2);
+ //上横
+ SetCell(GetFloorLayer(), p1, _autoTileConfig.TopMask.SourceId, _autoTileConfig.TopMask.AutoTileCoords);
+ //下横
+ SetCell(GetFloorLayer(), p2, _autoTileConfig.TopMask.SourceId, _autoTileConfig.TopMask.AutoTileCoords);
+ }
+ for (var y = yStart - 3; y <= yEnd + 2; y++)
+ {
+ var p1 = new Vector2I(xStart - 2, y);
+ var p2 = new Vector2I(xEnd + 2, y);
+ pos.Add(p1);
+ pos.Add(p2);
+ //左竖
+ SetCell(GetFloorLayer(), p1, _autoTileConfig.TopMask.SourceId, _autoTileConfig.TopMask.AutoTileCoords);
+ //右竖
+ SetCell(GetFloorLayer(), p2, _autoTileConfig.TopMask.SourceId, _autoTileConfig.TopMask.AutoTileCoords);
+ }
+
+ //计算需要绘制的图块
+ for (var x = xStart - 1; x <= xEnd + 1; x++)
+ {
+ for (var y = yStart - 2; y <= yEnd + 1; y++)
+ {
+ if (!_autoCellLayerGrid.Contains(x, y) && !_autoCellLayerGrid.Contains(x, y + 1))
+ {
+ list.Add(new Vector2I(x, y));
+ }
+ }
+ }
var arr = new Array(list);
//绘制自动图块
SetCellsTerrainConnect(AutoFloorLayer, arr, _terrainSet, _terrain, false);
- //---- 测试代码
- // var usedRect = GetUsedRect();
- // var endX = usedRect.End.X;
- // var endY = usedRect.End.X;
- // for (var x = usedRect.Position.X; x < endX; x++)
- // {
- // for (int y = usedRect.Position.Y; y < endY; y++)
- // {
- // var temp = GetCellAtlasCoords(AutoFloorLayer, new Vector2I(x, y));
- // var flag = temp == _autoTileConfig.T.AutoTileCoord || temp == _autoTileConfig.OUT_LT.AutoTileCoord || temp == _autoTileConfig.OUT_RT.AutoTileCoord;
- // if (flag)
- // {
- // SetCell(AutoFloorLayer, new Vector2I(x, y - 1), _sourceId, _autoTileConfig.T.AutoTileCoord);
- // break;
- // }
- // }
- // }
+
+ //擦除临时边界
+ for (var i = 0; i < pos.Count; i++)
+ {
+ EraseCell(GetFloorLayer(), pos[i]);
+ }
+
//计算区域
CalcTileRect(true);
+
+ //开始绘制导航网格
+ GenerateNavigation();
+
//将墙壁移动到指定层
MoveTerrainCell();
}
@@ -774,7 +818,7 @@
if (!_autoCellLayerGrid.Contains(pos) && GetCellSourceId(AutoFloorLayer, pos) != -1)
{
var atlasCoords = GetCellAtlasCoords(AutoFloorLayer, pos);
- var layer = _autoTileConfig.GetLayer(atlasCoords);
+ var layer = _autoTileConfig.GetLayer2(atlasCoords);
if (layer == GameConfig.MiddleMapLayer)
{
layer = AutoMiddleLayer;
@@ -796,20 +840,23 @@
}
//生成导航网格
- private bool GenerateNavigation()
+ private void GenerateNavigation()
{
- _dungeonTileMap.GenerateNavigationPolygon(AutoFloorLayer);
- var result = _dungeonTileMap.GetGenerateNavigationResult();
- if (result.Success)
+ var navigationRegion = _editorTileMap.L_NavigationRegion.Instance;
+ var navigationPolygon = navigationRegion.NavigationPolygon;
+ navigationPolygon.Clear();
+ navigationPolygon.ClearPolygons();
+ navigationPolygon.ClearOutlines();
+ var endPos = CurrRoomPosition + CurrRoomSize;
+ navigationPolygon.AddOutline(new []
{
- CloseErrorCell();
- }
- else
- {
- SetErrorCell(result.Exception.Point);
- }
-
- return result.Success;
+ CurrRoomPosition * GameConfig.TileCellSize,
+ new Vector2(endPos.X, CurrRoomPosition.Y) * GameConfig.TileCellSize,
+ endPos * GameConfig.TileCellSize,
+ new Vector2(CurrRoomPosition.X, endPos.Y) * GameConfig.TileCellSize
+ });
+ navigationRegion.BakeNavigationPolygon(false);
+ navigationRegion.Visible = true;
}
//设置显示的错误cell, 会标记上红色的闪烁动画
@@ -977,17 +1024,8 @@
//存入本地
var roomInfo = CurrRoomSplit.RoomInfo;
- if (!HasTerrainError) //没有绘制错误
- {
- roomInfo.Size = new SerializeVector2(CurrRoomSize);
- roomInfo.Position = new SerializeVector2(CurrRoomPosition);
- }
- else
- {
- roomInfo.Position = new SerializeVector2(CurrRoomPosition - Vector2I.One);
- roomInfo.Size = new SerializeVector2(CurrRoomSize + new Vector2I(2, 2));
- }
-
+ roomInfo.Size = new SerializeVector2(CurrRoomSize);
+ roomInfo.Position = new SerializeVector2(CurrRoomPosition);
roomInfo.DoorAreaInfos.Clear();
roomInfo.DoorAreaInfos.AddRange(CurrDoorConfigs);
roomInfo.ClearCompletionDoorArea();
@@ -1000,7 +1038,8 @@
//存入本地
var tileInfo = CurrRoomSplit.TileInfo;
tileInfo.NavigationList.Clear();
- tileInfo.NavigationList.AddRange(_dungeonTileMap.GetPolygonData());
+ Debug.LogError("存入导航网格数据");
+ //tileInfo.NavigationList.AddRange(_dungeonTileMap.GetPolygonData());
tileInfo.Floor.Clear();
tileInfo.Middle.Clear();
tileInfo.Top.Clear();
@@ -1176,4 +1215,22 @@
}
}
}
+
+ private void OnBakeFinished()
+ {
+ var polygonData = _editorTileMap.L_NavigationRegion.Instance.NavigationPolygon;
+ var polygons = polygonData.Polygons;
+ var vertices = polygonData.Vertices;
+ _polygonData = new Vector2[polygons.Count][];
+ for (var i = 0; i < polygons.Count; i++)
+ {
+ var polygon = polygons[i];
+ var v2Array = new Vector2[polygon.Length];
+ for (var j = 0; j < polygon.Length; j++)
+ {
+ v2Array[j] = vertices[polygon[j]];
+ }
+ _polygonData[i] = v2Array;
+ }
+ }
}
\ No newline at end of file
diff --git a/DungeonShooting_Godot/src/test/TestGridData.cs b/DungeonShooting_Godot/src/test/TestGridData.cs
index 6049363..62f1d61 100644
--- a/DungeonShooting_Godot/src/test/TestGridData.cs
+++ b/DungeonShooting_Godot/src/test/TestGridData.cs
@@ -97,7 +97,7 @@
time = DateTime.Now;
testGrid2.ForEach((i, i1, arg3) =>
{
-
+ return true;
});
Debug.Log("Grid遍历用时: " + (DateTime.Now - time).Milliseconds);
}
diff --git a/DungeonShooting_Godot/src/test/TestNewTerrain.cs b/DungeonShooting_Godot/src/test/TestNewTerrain.cs
index c58daea..27d3958 100644
--- a/DungeonShooting_Godot/src/test/TestNewTerrain.cs
+++ b/DungeonShooting_Godot/src/test/TestNewTerrain.cs
@@ -14,7 +14,7 @@
public override void _Ready()
{
_tileMap = GetNode("TileMap2");
- _navigationRegion = GetNode("NavigationRegion2D");
+ _navigationRegion = GetNode("TileMap2/NavigationRegion2D");
_navigationRegion.BakeFinished += BakeFinished;
RunTest();
}
@@ -33,7 +33,6 @@
{
v2Array[j] = vertices[polygon[j]];
}
- Debug.Log($"IsPolygonClockwise: {Geometry2D.IsPolygonClockwise(v2Array)}");
_polygonData[i] = v2Array;
}
}
@@ -61,6 +60,7 @@
var data = new NavigationPolygon();
data.SourceGeometryMode = NavigationPolygon.SourceGeometryModeEnum.GroupsWithChildren;
data.SourceGeometryGroupName = "navigation";
+ data.CellSize = 4;
data.AgentRadius = 6.5f;
data.AddOutline(new []
{