diff --git a/DungeonShooting_Godot/prefab/ui/MapEditor.tscn b/DungeonShooting_Godot/prefab/ui/MapEditor.tscn index 3db180e..d3ded4f 100644 --- a/DungeonShooting_Godot/prefab/ui/MapEditor.tscn +++ b/DungeonShooting_Godot/prefab/ui/MapEditor.tscn @@ -5,6 +5,33 @@ [ext_resource type="Script" path="res://src/game/ui/mapEditor/TileView/EditorTileMap.cs" id="2_waq8f"] [ext_resource type="Texture2D" uid="uid://0878uloew5jo" path="res://resource/sprite/ui/mapEditor/ErrorCell.png" id="4_465u2"] +[sub_resource type="Animation" id="Animation_o3btm"] +length = 0.001 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath(".:visible") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 1, +"values": [false] +} +tracks/1/type = "value" +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/path = NodePath(".:modulate") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [Color(1, 0, 0, 0)] +} + [sub_resource type="Animation" id="Animation_wnqg6"] resource_name = "show" length = 2.0 @@ -34,33 +61,6 @@ "values": [Color(1, 0, 0, 0), Color(1, 0, 0, 0.490196), Color(1, 0, 0, 0.490196), Color(1, 0, 0, 0)] } -[sub_resource type="Animation" id="Animation_o3btm"] -length = 0.001 -tracks/0/type = "value" -tracks/0/imported = false -tracks/0/enabled = true -tracks/0/path = NodePath(".:visible") -tracks/0/interp = 1 -tracks/0/loop_wrap = true -tracks/0/keys = { -"times": PackedFloat32Array(0), -"transitions": PackedFloat32Array(1), -"update": 1, -"values": [false] -} -tracks/1/type = "value" -tracks/1/imported = false -tracks/1/enabled = true -tracks/1/path = NodePath(".:modulate") -tracks/1/interp = 1 -tracks/1/loop_wrap = true -tracks/1/keys = { -"times": PackedFloat32Array(0), -"transitions": PackedFloat32Array(1), -"update": 0, -"values": [Color(1, 0, 0, 0)] -} - [sub_resource type="AnimationLibrary" id="AnimationLibrary_371oi"] _data = { "RESET": SubResource("Animation_o3btm"), @@ -120,6 +120,7 @@ [node name="ErrorCell" type="Sprite2D" parent="Bg/HSplitContainer/Left/MapView/SubViewport/TileMap"] visible = false modulate = Color(1, 0, 0, 0) +z_index = 10 scale = Vector2(16, 16) texture = ExtResource("4_465u2") centered = false diff --git a/DungeonShooting_Godot/resource/sprite/role/enemy0001/enemy0001.png.import b/DungeonShooting_Godot/resource/sprite/role/enemy0001/enemy0001.png.import index b20c9a6..c36be94 100644 --- a/DungeonShooting_Godot/resource/sprite/role/enemy0001/enemy0001.png.import +++ b/DungeonShooting_Godot/resource/sprite/role/enemy0001/enemy0001.png.import @@ -3,15 +3,15 @@ importer="texture" type="CompressedTexture2D" uid="uid://chd2vtesap5cf" -path="res://.godot/imported/enemy0001.png-1247a3ddf8a1a163d812cad12c4340fd.ctex" +path="res://.godot/imported/Enemy0001.png-148a38dfa95953b26d890356e8875de4.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://resource/sprite/role/enemy0001/enemy0001.png" -dest_files=["res://.godot/imported/enemy0001.png-1247a3ddf8a1a163d812cad12c4340fd.ctex"] +source_file="res://resource/sprite/role/enemy0001/Enemy0001.png" +dest_files=["res://.godot/imported/Enemy0001.png-148a38dfa95953b26d890356e8875de4.ctex"] [params] diff --git a/DungeonShooting_Godot/resource/sprite/role/enemy0001/enemy0001_Debris.png.import b/DungeonShooting_Godot/resource/sprite/role/enemy0001/enemy0001_Debris.png.import index 56388a2..d563acf 100644 --- a/DungeonShooting_Godot/resource/sprite/role/enemy0001/enemy0001_Debris.png.import +++ b/DungeonShooting_Godot/resource/sprite/role/enemy0001/enemy0001_Debris.png.import @@ -3,15 +3,15 @@ importer="texture" type="CompressedTexture2D" uid="uid://d2f55lu60x64i" -path="res://.godot/imported/enemy0001_Debris.png-297a2fb6680cb862a9a085cf58f8268c.ctex" +path="res://.godot/imported/Enemy0001_Debris.png-ac416dc79cd3c1217b27e1ef1fbe0d0b.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://resource/sprite/role/enemy0001/enemy0001_Debris.png" -dest_files=["res://.godot/imported/enemy0001_Debris.png-297a2fb6680cb862a9a085cf58f8268c.ctex"] +source_file="res://resource/sprite/role/enemy0001/Enemy0001_Debris.png" +dest_files=["res://.godot/imported/Enemy0001_Debris.png-ac416dc79cd3c1217b27e1ef1fbe0d0b.ctex"] [params] diff --git a/DungeonShooting_Godot/resource/theme/mainTheme.tres b/DungeonShooting_Godot/resource/theme/mainTheme.tres index 3cf5a71..b72afea 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_2evuq"] +[sub_resource type="Image" id="Image_bp6sj"] 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_2evuq") +image = SubResource("Image_bp6sj") [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_rgwcq"] +[sub_resource type="Image" id="Image_g1pk5"] 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_rgwcq") +image = SubResource("Image_g1pk5") [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_rsy3d"] +[sub_resource type="Image" id="Image_83s5x"] 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_rsy3d") +image = SubResource("Image_83s5x") [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_flfsw"] +[sub_resource type="Image" id="Image_3ox3y"] 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_flfsw") +image = SubResource("Image_3ox3y") [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_5lwa8"] +[sub_resource type="Image" id="Image_lnaup"] 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_5lwa8") +image = SubResource("Image_lnaup") [sub_resource type="StyleBoxFlat" id="57"] content_margin_left = 6.0 diff --git a/DungeonShooting_Godot/src/framework/Grid.cs b/DungeonShooting_Godot/src/framework/Grid.cs index 585eacf..ec37b93 100644 --- a/DungeonShooting_Godot/src/framework/Grid.cs +++ b/DungeonShooting_Godot/src/framework/Grid.cs @@ -26,6 +26,14 @@ return false; } + + /// + /// 返回指定xy位置是否有数据 + /// + public bool Contains(Vector2I pos) + { + return Contains(pos.X, pos.Y); + } /// /// 设置指定xy位置的数据 @@ -45,6 +53,14 @@ } /// + /// 设置指定坐标的数据 + /// + public void Set(Vector2I pos, T data) + { + Set(pos.X, pos.Y, data); + } + + /// /// 获取指定xy位置的数据 /// public T Get(int x, int y) @@ -61,6 +77,14 @@ } /// + /// 获取指定坐标的数据 + /// + public T Get(Vector2I pos) + { + return Get(pos.X, pos.Y); + } + + /// /// 移除指定xy位置存储的数据 /// public bool Remove(int x, int y) diff --git a/DungeonShooting_Godot/src/framework/map/DungeonTile.cs b/DungeonShooting_Godot/src/framework/map/DungeonTile.cs index edc97c4..6065788 100644 --- a/DungeonShooting_Godot/src/framework/map/DungeonTile.cs +++ b/DungeonShooting_Godot/src/framework/map/DungeonTile.cs @@ -10,7 +10,7 @@ //--------------------- 导航 ------------------------- //已经标记过的点 - private readonly HashSet _usePoints = new HashSet(); + private readonly HashSet _usePoints = new HashSet(); //导航区域数据 private readonly List _polygonDataList = new List(); @@ -127,17 +127,8 @@ // var customData = tileInstance.GetCellTileData(0, coords).GetCustomData(CustomTileLayerName); // var layer = customData.AsInt32(); // layer = Mathf.Clamp(layer, GameConfig.FloorMapLayer, GameConfig.TopMapLayer); - - var layer = GameConfig.FloorMapLayer; - if (config.MiddleLayerAtlasCoords.Contains(atlasCoords)) - { - layer = GameConfig.MiddleMapLayer; - } - else if (config.TopLayerAtlasCoords.Contains(atlasCoords)) - { - layer = GameConfig.TopMapLayer; - } - + + var layer = config.GetLayer(atlasCoords); _tileRoot.SetCell(layer, new Vector2I(roomInfo.Position.X + i, roomInfo.Position.Y + j), 0, atlasCoords); } @@ -648,7 +639,7 @@ { if (IsWayTile(layer, i, j)) { - if (!_usePoints.Contains(new Vector2(i, j))) + if (!_usePoints.Contains(new Vector2I(i, j))) { NavigationPolygonData polygonData = null; @@ -782,7 +773,7 @@ var dir = 0; var offset = new Vector2(size.X * 0.5f, size.Y * 0.5f); //找到路, 向右开始找边界 - var startPos = new Vector2(i, j); + var startPos = new Vector2I(i, j); var tempI = i; var tempJ = j; @@ -797,7 +788,7 @@ { dir = 3; - var pos = new Vector2(tempI, tempJ); + var pos = new Vector2I(tempI, tempJ); if (points.Count > 1 && pos == startPos) { return polygonData; @@ -816,13 +807,13 @@ points.Add(new SerializeVector2(tempI * size.X + offset.X, tempJ * size.Y + offset.Y)); } - var pos = new Vector2(tempI, tempJ); + var pos = new Vector2I(tempI, tempJ); if (points.Count > 1 && pos == startPos) { return polygonData; } - PutUsePoint(new Vector2(tempI, tempJ)); + PutUsePoint(new Vector2I(tempI, tempJ)); tempI++; break; } @@ -830,7 +821,7 @@ { dir = 1; - var pos = new Vector2(tempI, tempJ); + var pos = new Vector2I(tempI, tempJ); if (points.Count > 1 && pos == startPos) { return polygonData; @@ -843,7 +834,7 @@ break; } - throw new NavigationPointInterleavingException(new Vector2(tempI, tempJ), "生成导航多边形发生错误! 点: " + new Vector2(tempI, tempJ) + "发生交错!"); + throw new NavigationPointInterleavingException(new Vector2I(tempI, tempJ), "生成导航多边形发生错误! 点: " + new Vector2I(tempI, tempJ) + "发生交错!"); } case 1: //下 { @@ -851,7 +842,7 @@ { dir = 0; - var pos = new Vector2(tempI, tempJ); + var pos = new Vector2I(tempI, tempJ); if (points.Count > 1 && pos == startPos) { return polygonData; @@ -870,13 +861,13 @@ points.Add(new SerializeVector2(tempI * size.X + offset.X, tempJ * size.Y + offset.Y)); } - var pos = new Vector2(tempI, tempJ); + var pos = new Vector2I(tempI, tempJ); if (points.Count > 1 && pos == startPos) { return polygonData; } - PutUsePoint(new Vector2(tempI, tempJ)); + PutUsePoint(new Vector2I(tempI, tempJ)); tempJ++; break; } @@ -884,7 +875,7 @@ { dir = 2; - var pos = new Vector2(tempI, tempJ); + var pos = new Vector2I(tempI, tempJ); if (points.Count > 1 && pos == startPos) { return polygonData; @@ -898,7 +889,7 @@ break; } - throw new NavigationPointInterleavingException(new Vector2(tempI, tempJ), "生成导航多边形发生错误! 点: " + new Vector2(tempI, tempJ) + "发生交错!"); + throw new NavigationPointInterleavingException(new Vector2I(tempI, tempJ), "生成导航多边形发生错误! 点: " + new Vector2I(tempI, tempJ) + "发生交错!"); } case 2: //左 { @@ -906,7 +897,7 @@ { dir = 1; - var pos = new Vector2(tempI, tempJ); + var pos = new Vector2I(tempI, tempJ); if (points.Count > 1 && pos == startPos) { return polygonData; @@ -927,13 +918,13 @@ points.Add(new SerializeVector2(tempI * size.X + offset.X, tempJ * size.Y + offset.Y * 2)); } - var pos = new Vector2(tempI, tempJ); + var pos = new Vector2I(tempI, tempJ); if (points.Count > 1 && pos == startPos) { return polygonData; } - PutUsePoint(new Vector2(tempI, tempJ)); + PutUsePoint(new Vector2I(tempI, tempJ)); tempI--; break; } @@ -941,7 +932,7 @@ { dir = 3; - var pos = new Vector2(tempI, tempJ); + var pos = new Vector2I(tempI, tempJ); if (points.Count > 1 && pos == startPos) { return polygonData; @@ -955,7 +946,7 @@ break; } - throw new NavigationPointInterleavingException(new Vector2(tempI, tempJ), "生成导航多边形发生错误! 点: " + new Vector2(tempI, tempJ) + "发生交错!"); + throw new NavigationPointInterleavingException(new Vector2I(tempI, tempJ), "生成导航多边形发生错误! 点: " + new Vector2I(tempI, tempJ) + "发生交错!"); } case 3: //上 { @@ -963,7 +954,7 @@ { dir = 2; - var pos = new Vector2(tempI, tempJ); + var pos = new Vector2I(tempI, tempJ); if (points.Count > 1 && pos == startPos) { return polygonData; @@ -983,13 +974,13 @@ points.Add(new SerializeVector2(tempI * size.X + offset.X, tempJ * size.Y + offset.Y)); } - var pos = new Vector2(tempI, tempJ); + var pos = new Vector2I(tempI, tempJ); if (points.Count > 1 && pos == startPos) { return polygonData; } - PutUsePoint(new Vector2(tempI, tempJ)); + PutUsePoint(new Vector2I(tempI, tempJ)); tempJ--; break; } @@ -997,7 +988,7 @@ { dir = 0; - var pos = new Vector2(tempI, tempJ); + var pos = new Vector2I(tempI, tempJ); if (points.Count > 1 && pos == startPos) { return polygonData; @@ -1010,7 +1001,7 @@ break; } - throw new NavigationPointInterleavingException(new Vector2(tempI, tempJ), "生成导航多边形发生错误! 点: " + new Vector2(tempI, tempJ) + "发生交错!"); + throw new NavigationPointInterleavingException(new Vector2I(tempI, tempJ), "生成导航多边形发生错误! 点: " + new Vector2I(tempI, tempJ) + "发生交错!"); } } } @@ -1026,7 +1017,7 @@ var dir = 0; var offset = new Vector2(size.X * 0.5f, size.Y * 0.5f); //找到路, 向右开始找边界 - var startPos = new Vector2(i - 1, j); + var startPos = new Vector2I(i - 1, j); PutUsePoint(startPos); var tempI = i; @@ -1042,7 +1033,7 @@ { dir = 1; - var pos = new Vector2(tempI, tempJ); + var pos = new Vector2I(tempI, tempJ); if (points.Count > 1 && pos == startPos) { return polygonData; @@ -1063,13 +1054,13 @@ points.Add(new SerializeVector2((tempI - 1) * size.X + offset.X, tempJ * size.Y + offset.Y * 2)); } - var pos = new Vector2(tempI, tempJ); + var pos = new Vector2I(tempI, tempJ); if (points.Count > 1 && pos == startPos) { return polygonData; } - PutUsePoint(new Vector2(tempI, tempJ)); + PutUsePoint(new Vector2I(tempI, tempJ)); tempI++; break; } @@ -1077,7 +1068,7 @@ { dir = 3; - var pos = new Vector2(tempI, tempJ); + var pos = new Vector2I(tempI, tempJ); if (points.Count > 1 && pos == startPos) { return polygonData; @@ -1091,7 +1082,7 @@ break; } - throw new NavigationPointInterleavingException(new Vector2(tempI, tempJ), "生成导航多边形发生错误! 点: " + new Vector2(tempI, tempJ) + "发生交错!"); + throw new NavigationPointInterleavingException(new Vector2I(tempI, tempJ), "生成导航多边形发生错误! 点: " + new Vector2I(tempI, tempJ) + "发生交错!"); } case 1: //下 { @@ -1099,7 +1090,7 @@ { dir = 2; - var pos = new Vector2(tempI, tempJ); + var pos = new Vector2I(tempI, tempJ); if (points.Count > 1 && pos == startPos) { return polygonData; @@ -1118,13 +1109,13 @@ points.Add(new SerializeVector2((tempI - 1) * size.X + offset.X, tempJ * size.Y + offset.Y)); } - var pos = new Vector2(tempI, tempJ); + var pos = new Vector2I(tempI, tempJ); if (points.Count > 1 && pos == startPos) { return polygonData; } - PutUsePoint(new Vector2(tempI, tempJ)); + PutUsePoint(new Vector2I(tempI, tempJ)); tempJ++; break; } @@ -1132,7 +1123,7 @@ { dir = 0; - var pos = new Vector2(tempI, tempJ); + var pos = new Vector2I(tempI, tempJ); if (points.Count > 1 && pos == startPos) { return polygonData; @@ -1146,7 +1137,7 @@ break; } - throw new NavigationPointInterleavingException(new Vector2(tempI, tempJ), "生成导航多边形发生错误! 点: " + new Vector2(tempI, tempJ) + "发生交错!"); + throw new NavigationPointInterleavingException(new Vector2I(tempI, tempJ), "生成导航多边形发生错误! 点: " + new Vector2I(tempI, tempJ) + "发生交错!"); } case 2: //左 { @@ -1154,7 +1145,7 @@ { dir = 3; - var pos = new Vector2(tempI, tempJ); + var pos = new Vector2I(tempI, tempJ); if (points.Count > 1 && pos == startPos) { return polygonData; @@ -1173,13 +1164,13 @@ points.Add(new SerializeVector2((tempI - 1) * size.X + offset.X, tempJ * size.Y + offset.Y)); } - var pos = new Vector2(tempI, tempJ); + var pos = new Vector2I(tempI, tempJ); if (points.Count > 1 && pos == startPos) { return polygonData; } - PutUsePoint(new Vector2(tempI, tempJ)); + PutUsePoint(new Vector2I(tempI, tempJ)); tempI--; break; } @@ -1187,7 +1178,7 @@ { dir = 1; - var pos = new Vector2(tempI, tempJ); + var pos = new Vector2I(tempI, tempJ); if (points.Count > 1 && pos == startPos) { return polygonData; @@ -1200,7 +1191,7 @@ break; } - throw new NavigationPointInterleavingException(new Vector2(tempI, tempJ), "生成导航多边形发生错误! 点: " + new Vector2(tempI, tempJ) + "发生交错!"); + throw new NavigationPointInterleavingException(new Vector2I(tempI, tempJ), "生成导航多边形发生错误! 点: " + new Vector2I(tempI, tempJ) + "发生交错!"); } case 3: //上 { @@ -1208,7 +1199,7 @@ { dir = 0; - var pos = new Vector2(tempI, tempJ); + var pos = new Vector2I(tempI, tempJ); if (points.Count > 1 && pos == startPos) { return polygonData; @@ -1228,13 +1219,13 @@ points.Add(new SerializeVector2((tempI - 1) * size.X + offset.X, tempJ * size.Y + offset.Y)); } - var pos = new Vector2(tempI, tempJ); + var pos = new Vector2I(tempI, tempJ); if (points.Count > 1 && pos == startPos) { return polygonData; } - PutUsePoint(new Vector2(tempI, tempJ)); + PutUsePoint(new Vector2I(tempI, tempJ)); tempJ--; break; } @@ -1242,7 +1233,7 @@ { dir = 2; - var pos = new Vector2(tempI, tempJ); + var pos = new Vector2I(tempI, tempJ); if (points.Count > 1 && pos == startPos) { return polygonData; @@ -1255,14 +1246,14 @@ break; } - throw new NavigationPointInterleavingException(new Vector2(tempI, tempJ), "生成导航多边形发生错误! 点: " + new Vector2(tempI, tempJ) + "发生交错!"); + throw new NavigationPointInterleavingException(new Vector2I(tempI, tempJ), "生成导航多边形发生错误! 点: " + new Vector2I(tempI, tempJ) + "发生交错!"); } } } } //记录导航网格中已经使用过的坐标 - private void PutUsePoint(Vector2 pos) + private void PutUsePoint(Vector2I pos) { if (_usePoints.Contains(pos)) { diff --git a/DungeonShooting_Godot/src/framework/map/NavigationPointInterleavingException.cs b/DungeonShooting_Godot/src/framework/map/NavigationPointInterleavingException.cs index 284683c..f4f7e9e 100644 --- a/DungeonShooting_Godot/src/framework/map/NavigationPointInterleavingException.cs +++ b/DungeonShooting_Godot/src/framework/map/NavigationPointInterleavingException.cs @@ -10,9 +10,9 @@ /// /// 交错点 /// - public Vector2 Point { get; } + public Vector2I Point { get; } - public NavigationPointInterleavingException(Vector2 point, string message): base(message) + public NavigationPointInterleavingException(Vector2I point, string message): base(message) { Point = point; } diff --git a/DungeonShooting_Godot/src/game/room/AutoTileConfig.cs b/DungeonShooting_Godot/src/game/room/AutoTileConfig.cs index 98cd72d..07bcf9d 100644 --- a/DungeonShooting_Godot/src/game/room/AutoTileConfig.cs +++ b/DungeonShooting_Godot/src/game/room/AutoTileConfig.cs @@ -7,29 +7,6 @@ /// public class AutoTileConfig { - public List MiddleLayerAtlasCoords = new List() - { - new Vector2I(1, 6), - new Vector2I(2, 6), - new Vector2I(3, 6), - new Vector2I(1, 7), - new Vector2I(2, 7), - new Vector2I(3, 7), - }; - - public List TopLayerAtlasCoords = new List() - { - new Vector2I(1, 4), - new Vector2I(1, 3), - new Vector2I(1, 2), - new Vector2I(2, 2), - new Vector2I(3, 2), - new Vector2I(3, 3), - new Vector2I(3, 4), - new Vector2I(11, 2), - new Vector2I(13, 2), - }; - public TileCellInfo IN_LT = new TileCellInfo(0, new Vector2I(3, 3)); public TileCellInfo IN_LB = new TileCellInfo(0, new Vector2I(11, 2)); public TileCellInfo IN_RT = new TileCellInfo(0, new Vector2I(1, 3)); @@ -44,4 +21,42 @@ public TileCellInfo OUT_LB = new TileCellInfo(0, new Vector2I(1, 7)); public TileCellInfo OUT_RT = new TileCellInfo(0, new Vector2I(3, 2)); public TileCellInfo OUT_RB = new TileCellInfo(0, new Vector2I(3, 7)); + + private List _middleLayerAtlasCoords = new List() + { + new Vector2I(1, 6), + new Vector2I(2, 6), + new Vector2I(3, 6), + new Vector2I(1, 7), + new Vector2I(2, 7), + new Vector2I(3, 7), + }; + + private List _topLayerAtlasCoords = new List() + { + new Vector2I(1, 4), + new Vector2I(1, 3), + new Vector2I(1, 2), + new Vector2I(2, 2), + new Vector2I(3, 2), + new Vector2I(3, 3), + new Vector2I(3, 4), + new Vector2I(11, 2), + new Vector2I(13, 2), + }; + + public int GetLayer(Vector2I atlasCoords) + { + var layer = GameConfig.FloorMapLayer; + if (_middleLayerAtlasCoords.Contains(atlasCoords)) + { + layer = GameConfig.MiddleMapLayer; + } + else if (_topLayerAtlasCoords.Contains(atlasCoords)) + { + layer = GameConfig.TopMapLayer; + } + + return layer; + } } \ No newline at end of file diff --git a/DungeonShooting_Godot/src/game/ui/mapEditor/TileView/EditorTileMap.cs b/DungeonShooting_Godot/src/game/ui/mapEditor/TileView/EditorTileMap.cs index fecff92..8291f94 100644 --- a/DungeonShooting_Godot/src/game/ui/mapEditor/TileView/EditorTileMap.cs +++ b/DungeonShooting_Godot/src/game/ui/mapEditor/TileView/EditorTileMap.cs @@ -59,13 +59,23 @@ private Grid _autoCellLayerGrid = new Grid(); //用于生成导航网格 private DungeonTile _dungeonTile; - private float _generateNavigationTimer = -1; + //停止绘制多久后开始执行生成操作 + private float _generateInterval = 3f; + //生成自动图块和导航网格的计时器 + private float _generateTimer = -1; + //检测地形结果 + private bool _checkTerrainFlag = true; + //错误地形位置 + private Vector2I _checkTerrainErrorPosition = Vector2I.Zero; + //是否执行生成地形成功 + private bool _isGenerateTerrain = false; //--------- 配置数据 ------------- private int _sourceId = 0; private int _terrainSet = 0; private int _terrain = 0; private Vector2I _floorAtlasCoords = new Vector2I(0, 8); + private AutoTileConfig _autoTileConfig = new AutoTileConfig(); //------------------------------- public override void _Ready() @@ -135,13 +145,26 @@ } //绘制停止指定时间后, 生成导航网格 - if (_generateNavigationTimer > 0) + if (_generateTimer > 0) { - _generateNavigationTimer -= newDelta; - if (_generateNavigationTimer <= 0) + _generateTimer -= newDelta; + if (_generateTimer <= 0) { - GD.Print("开始绘制导航网格..."); - GenerateNavigation(); + GD.Print("开始检测是否可以生成地形..."); + if (CheckTerrain()) + { + GD.Print("开始绘制导航网格..."); + if (GenerateNavigation()) + { + GD.Print("开始绘制自动贴图..."); + GenerateTerrain(); + _isGenerateTerrain = true; + } + } + else + { + SetErrorCell(_checkTerrainErrorPosition); + } } } } @@ -154,13 +177,16 @@ //轴线 canvasItem.DrawLine(new Vector2(0, 2000), new Vector2(0, -2000), Colors.Green); canvasItem.DrawLine(new Vector2(2000, 0), new Vector2( -2000, 0), Colors.Red); - - //绘制导航网格 - var result = _dungeonTile.GetGenerateNavigationResult(); - if (result != null && result.Success) + + if (_checkTerrainFlag) //已经通过地形检测 { - var polygonData = _dungeonTile.GetPolygonData(); - Utils.DrawNavigationPolygon(canvasItem, polygonData, 1); + //绘制导航网格 + var result = _dungeonTile.GetGenerateNavigationResult(); + if (result != null && result.Success) + { + var polygonData = _dungeonTile.GetPolygonData(); + Utils.DrawNavigationPolygon(canvasItem, polygonData, 1); + } } if (_drawFullRect) //绘制填充矩形 @@ -247,14 +273,6 @@ } } } - else if (@event is InputEventKey eventKey) - { - //测试生成自动图块 - if (eventKey.KeyLabel == Key.M && eventKey.Pressed) - { - GenerateTerrain(); - } - } } //缩小 @@ -292,15 +310,18 @@ //绘制单个自动贴图 private void SetSingleAutoCell(Vector2I position) { - _generateNavigationTimer = 3; SetCell(GetFloorLayer(), position, _sourceId, _floorAtlasCoords); - _autoCellLayerGrid.Set(position.X, position.Y, true); + if (!_autoCellLayerGrid.Contains(position.X, position.Y)) + { + ResetGenerateTimer(); + _autoCellLayerGrid.Set(position.X, position.Y, true); + } } //绘制区域自动贴图 private void SetRectAutoCell(Vector2I start, Vector2I end) { - _generateNavigationTimer = 3; + ResetGenerateTimer(); if (start.X > end.X) { @@ -331,15 +352,17 @@ //擦除单个自动图块 private void EraseSingleAutoCell(Vector2I position) { - _generateNavigationTimer = 3; EraseCell(GetFloorLayer(), position); - _autoCellLayerGrid.Remove(position.X, position.Y); + if (_autoCellLayerGrid.Remove(position.X, position.Y)) + { + ResetGenerateTimer(); + } } //擦除一个区域内的自动贴图 private void EraseRectAutoCell(Vector2I start, Vector2I end) { - _generateNavigationTimer = 3; + ResetGenerateTimer(); if (start.X > end.X) { @@ -366,6 +389,16 @@ _autoCellLayerGrid.RemoveRect(start, new Vector2I(width, height)); } + //重置计时器 + private void ResetGenerateTimer() + { + _generateTimer = _generateInterval; + _isGenerateTerrain = false; + SetLayerEnabled(AutoTopLayer, false); + SetLayerEnabled(AutoMiddleLayer, false); + } + + //检测是否有不合规的图块, 返回true表示图块正常 private bool CheckTerrain() { var usedRect = GetUsedRect(); @@ -373,18 +406,31 @@ var y = usedRect.Position.Y; var w = usedRect.Size.X; var h = usedRect.Size.Y; - //执行刷墙逻辑 - - // //先检测对角是否有地板 - // var left = _autoCellLayerGrid.Get(position.X - 1, position.Y); - // var right = _autoCellLayerGrid.Get(position.X + 1, position.Y); - // var top = _autoCellLayerGrid.Get(position.X, position.Y + 1); - // var down = _autoCellLayerGrid.Get(position.X, position.Y - 1); - // - // if ((left && right) || (top && down)) - // { - // GD.Print("错误的地图块..."); - // } + + for (var i = 0; i < w; i++) + { + for (var j = 0; j < h; j++) + { + var pos = new Vector2I(x + i, y + j); + if (GetCellSourceId(AutoFloorLayer, pos) == -1) + { + //先检测对角是否有地板 + var left = _autoCellLayerGrid.Get(pos.X - 1, pos.Y); + var right = _autoCellLayerGrid.Get(pos.X + 1, pos.Y); + var top = _autoCellLayerGrid.Get(pos.X, pos.Y + 1); + var down = _autoCellLayerGrid.Get(pos.X, pos.Y - 1); + + if ((left && right) || (top && down)) + { + _checkTerrainFlag = false; + _checkTerrainErrorPosition = pos; + return false; + } + } + } + } + + _checkTerrainFlag = true; return true; } @@ -392,6 +438,7 @@ private void GenerateTerrain() { ClearLayer(AutoFloorLayer); + var list = new List(); _autoCellLayerGrid.ForEach((x, y, data) => { @@ -402,22 +449,80 @@ }); var arr = new Array(list); SetCellsTerrainConnect(AutoFloorLayer, arr, _terrainSet, _terrain, false); + MoveTerrainCell(); + } + + //将自动生成的图块从 AutoFloorLayer 移动到指定图层中 + private void MoveTerrainCell() + { + SetLayerEnabled(AutoTopLayer, true); + SetLayerEnabled(AutoMiddleLayer, true); + ClearLayer(AutoTopLayer); + ClearLayer(AutoMiddleLayer); + + var usedRect = GetUsedRect(); + var x = usedRect.Position.X; + var y = usedRect.Position.Y; + var w = usedRect.Size.X; + var h = usedRect.Size.Y; + + for (var i = 0; i < w; i++) + { + for (var j = 0; j < h; j++) + { + var pos = new Vector2I(x + i, y + j); + if (!_autoCellLayerGrid.Contains(pos) && GetCellSourceId(AutoFloorLayer, pos) != -1) + { + var atlasCoords = GetCellAtlasCoords(AutoFloorLayer, pos); + var layer = _autoTileConfig.GetLayer(atlasCoords); + if (layer == GameConfig.MiddleMapLayer) + { + layer = AutoMiddleLayer; + } + else if (layer == GameConfig.TopMapLayer) + { + layer = AutoTopLayer; + } + else + { + GD.PrintErr($"异常图块: {pos}, 这个图块的图集坐标'{atlasCoords}'不属于'MiddleMapLayer'和'TopMapLayer'!"); + continue; + } + EraseCell(AutoFloorLayer, pos); + SetCell(layer, pos, _sourceId, atlasCoords); + } + } + } } //生成导航网格 - private void GenerateNavigation() + private bool GenerateNavigation() { _dungeonTile.GenerateNavigationPolygon(AutoFloorLayer); var result = _dungeonTile.GetGenerateNavigationResult(); if (result.Success) { - MapEditorPanel.S_ErrorCellAnimationPlayer.Instance.Stop(); + CloseErrorCell(); } else { - MapEditorPanel.S_ErrorCell.Instance.Position = result.Exception.Point * CellQuadrantSize; - MapEditorPanel.S_ErrorCellAnimationPlayer.Instance.Play(AnimatorNames.Show); + SetErrorCell(result.Exception.Point); } + + return result.Success; + } + + //设置显示的错误cell, 会标记上红色的闪烁动画 + private void SetErrorCell(Vector2I pos) + { + MapEditorPanel.S_ErrorCell.Instance.Position = pos * CellQuadrantSize; + MapEditorPanel.S_ErrorCellAnimationPlayer.Instance.Play(AnimatorNames.Show); + } + + //关闭显示的错误cell + private void CloseErrorCell() + { + MapEditorPanel.S_ErrorCellAnimationPlayer.Instance.Stop(); } private int GetFloorLayer()