diff --git a/DungeonShooting_Godot/prefab/shell/Shell0001.tscn b/DungeonShooting_Godot/prefab/shell/Shell0001.tscn index 4e64f26..b7f2eb4 100644 --- a/DungeonShooting_Godot/prefab/shell/Shell0001.tscn +++ b/DungeonShooting_Godot/prefab/shell/Shell0001.tscn @@ -17,6 +17,7 @@ shader_parameter/schedule = 0.0 [node name="Shell0001" type="CharacterBody2D" node_paths=PackedStringArray("ShadowSprite", "AnimatedSprite", "Collision")] +collision_layer = 128 script = ExtResource("1_2g70c") ShadowSprite = NodePath("ShadowSprite") AnimatedSprite = NodePath("AnimatedSprite") diff --git a/DungeonShooting_Godot/prefab/weapon/Weapon0001.tscn b/DungeonShooting_Godot/prefab/weapon/Weapon0001.tscn index a78a966..ae6e01b 100644 --- a/DungeonShooting_Godot/prefab/weapon/Weapon0001.tscn +++ b/DungeonShooting_Godot/prefab/weapon/Weapon0001.tscn @@ -15,7 +15,7 @@ resource_local_to_scene = true shader = ExtResource("3_x1q03") shader_parameter/blend = Color(1, 1, 1, 1) -shader_parameter/schedule = 1.0 +shader_parameter/schedule = 0.0 [node name="Weapon0001" node_paths=PackedStringArray("FirePoint", "ShellPoint", "GripPoint", "AnimationPlayer", "ShadowSprite", "AnimatedSprite", "Collision") instance=ExtResource("1_ykl0r")] script = ExtResource("2_t56pk") diff --git a/DungeonShooting_Godot/prefab/weapon/Weapon0002.tscn b/DungeonShooting_Godot/prefab/weapon/Weapon0002.tscn index 6e8bef2..2aa969b 100644 --- a/DungeonShooting_Godot/prefab/weapon/Weapon0002.tscn +++ b/DungeonShooting_Godot/prefab/weapon/Weapon0002.tscn @@ -14,7 +14,7 @@ resource_local_to_scene = true shader = ExtResource("2_8nvny") shader_parameter/blend = Color(1, 1, 1, 1) -shader_parameter/schedule = 1.0 +shader_parameter/schedule = 0.0 [sub_resource type="RectangleShape2D" id="RectangleShape2D_3p5jk"] size = Vector2(19.5, 8.75) diff --git a/DungeonShooting_Godot/prefab/weapon/Weapon0003.tscn b/DungeonShooting_Godot/prefab/weapon/Weapon0003.tscn index 0528bbe..6a19802 100644 --- a/DungeonShooting_Godot/prefab/weapon/Weapon0003.tscn +++ b/DungeonShooting_Godot/prefab/weapon/Weapon0003.tscn @@ -14,7 +14,7 @@ resource_local_to_scene = true shader = ExtResource("2_4yjnk") shader_parameter/blend = Color(1, 1, 1, 1) -shader_parameter/schedule = 1.0 +shader_parameter/schedule = 0.0 [sub_resource type="RectangleShape2D" id="RectangleShape2D_3p5jk"] size = Vector2(14, 8) diff --git a/DungeonShooting_Godot/prefab/weapon/Weapon0004.tscn b/DungeonShooting_Godot/prefab/weapon/Weapon0004.tscn index d1739d1..7843a77 100644 --- a/DungeonShooting_Godot/prefab/weapon/Weapon0004.tscn +++ b/DungeonShooting_Godot/prefab/weapon/Weapon0004.tscn @@ -16,7 +16,7 @@ resource_local_to_scene = true shader = ExtResource("3_63s5g") shader_parameter/blend = Color(1, 1, 1, 1) -shader_parameter/schedule = 1.0 +shader_parameter/schedule = 0.0 [node name="Weapon0004" node_paths=PackedStringArray("FirePoint", "ShellPoint", "GripPoint", "AnimationPlayer", "ShadowSprite", "AnimatedSprite", "Collision") instance=ExtResource("1_kg172")] script = ExtResource("2_v1wer") diff --git a/DungeonShooting_Godot/prefab/weapon/Weapon0005.tscn b/DungeonShooting_Godot/prefab/weapon/Weapon0005.tscn index 2ff4621..342ee85 100644 --- a/DungeonShooting_Godot/prefab/weapon/Weapon0005.tscn +++ b/DungeonShooting_Godot/prefab/weapon/Weapon0005.tscn @@ -14,7 +14,7 @@ resource_local_to_scene = true shader = ExtResource("1_466gw") shader_parameter/blend = Color(1, 1, 1, 1) -shader_parameter/schedule = 1.0 +shader_parameter/schedule = 0.0 [sub_resource type="RectangleShape2D" id="RectangleShape2D_3p5jk"] size = Vector2(26, 8) diff --git a/DungeonShooting_Godot/prefab/weapon/Weapon0006.tscn b/DungeonShooting_Godot/prefab/weapon/Weapon0006.tscn index 16a5739..c6c2e9b 100644 --- a/DungeonShooting_Godot/prefab/weapon/Weapon0006.tscn +++ b/DungeonShooting_Godot/prefab/weapon/Weapon0006.tscn @@ -14,7 +14,7 @@ resource_local_to_scene = true shader = ExtResource("1_rp1bw") shader_parameter/blend = Color(1, 1, 1, 1) -shader_parameter/schedule = 1.0 +shader_parameter/schedule = 0.0 [sub_resource type="RectangleShape2D" id="RectangleShape2D_3p5jk"] size = Vector2(12, 10) diff --git a/DungeonShooting_Godot/prefab/weapon/WeaponTemplate.tscn b/DungeonShooting_Godot/prefab/weapon/WeaponTemplate.tscn index 88ec9bf..254e507 100644 --- a/DungeonShooting_Godot/prefab/weapon/WeaponTemplate.tscn +++ b/DungeonShooting_Godot/prefab/weapon/WeaponTemplate.tscn @@ -12,7 +12,7 @@ resource_local_to_scene = true shader = ExtResource("1_3p8rg") shader_parameter/blend = Color(1, 1, 1, 1) -shader_parameter/schedule = 1.0 +shader_parameter/schedule = 0.0 [sub_resource type="RectangleShape2D" id="RectangleShape2D_3p5jk"] size = Vector2(19.5, 8.75) diff --git a/DungeonShooting_Godot/project.godot b/DungeonShooting_Godot/project.godot index 601f8cb..3e12ec5 100644 --- a/DungeonShooting_Godot/project.godot +++ b/DungeonShooting_Godot/project.godot @@ -182,7 +182,8 @@ 2d_physics/layer_5="enemy" 2d_physics/layer_6="affiliation" 2d_physics/layer_7="onHead" -2d_physics/layer_8="In hand" +2d_physics/layer_8="shell" +2d_physics/layer_9="throwing" [mono] diff --git a/DungeonShooting_Godot/resource/material/Blend.gdshader b/DungeonShooting_Godot/resource/material/Blend.gdshader index 68a6001..fcc9b33 100644 --- a/DungeonShooting_Godot/resource/material/Blend.gdshader +++ b/DungeonShooting_Godot/resource/material/Blend.gdshader @@ -1,7 +1,7 @@ shader_type canvas_item; uniform vec4 blend : source_color = vec4(1.0, 1.0, 1.0, 1.0); -uniform float schedule = 1.0; +uniform float schedule = 0.0; void fragment() { vec4 textureColor = texture(TEXTURE, UV); diff --git a/DungeonShooting_Godot/resource/theme/mainTheme.tres b/DungeonShooting_Godot/resource/theme/mainTheme.tres index 166cfd7..c33db4e 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_aglhd"] +[sub_resource type="Image" id="Image_ji00c"] 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_aglhd") +image = SubResource("Image_ji00c") [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_ar12w"] +[sub_resource type="Image" id="Image_g5vbn"] 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_ar12w") +image = SubResource("Image_g5vbn") [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_ov3wi"] +[sub_resource type="Image" id="Image_1firp"] 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_ov3wi") +image = SubResource("Image_1firp") [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_iadju"] +[sub_resource type="Image" id="Image_8rrrg"] 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_iadju") +image = SubResource("Image_8rrrg") [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_mjtu7"] +[sub_resource type="Image" id="Image_inqjn"] 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_mjtu7") +image = SubResource("Image_inqjn") [sub_resource type="StyleBoxFlat" id="57"] content_margin_left = 6.0 diff --git a/DungeonShooting_Godot/src/framework/activity/ActivityObject.cs b/DungeonShooting_Godot/src/framework/activity/ActivityObject.cs index af5d76e..bd486c8 100644 --- a/DungeonShooting_Godot/src/framework/activity/ActivityObject.cs +++ b/DungeonShooting_Godot/src/framework/activity/ActivityObject.cs @@ -254,6 +254,8 @@ private bool _enableBehavior = true; private bool _enableBehaviorCollisionDisabledFlag; + private bool _processingBecomesStaticImage = false; + // -------------------------------------------------------------------------------- //实例索引 @@ -606,8 +608,8 @@ /// 初始高度 /// 纵轴速度 /// 移动速率 - /// 旋转速度 - public void Throw(float altitude, float verticalSpeed, Vector2 velocity, float rotate) + /// 旋转速度 + public void Throw(float altitude, float verticalSpeed, Vector2 velocity, float rotateSpeed) { var parent = GetParent(); if (parent == null) @@ -623,7 +625,7 @@ Altitude = altitude; //Position = Position + new Vector2(0, altitude); VerticalSpeed = verticalSpeed; - ThrowRotationDegreesSpeed = rotate; + ThrowRotationDegreesSpeed = rotateSpeed; if (_throwForce != null) { MoveController.RemoveForce(_throwForce); @@ -643,11 +645,11 @@ /// 初始高度 /// 纵轴速度 /// 移动速率 - /// 旋转速度 - public void Throw(Vector2 position, float altitude, float verticalSpeed, Vector2 velocity, float rotate) + /// 旋转速度 + public void Throw(Vector2 position, float altitude, float verticalSpeed, Vector2 velocity, float rotateSpeed) { GlobalPosition = position; - Throw(altitude, verticalSpeed, velocity, rotate); + Throw(altitude, verticalSpeed, velocity, rotateSpeed); } @@ -1175,7 +1177,7 @@ Collision.Rotation = 0; Collision.Scale = Vector2.One; CollisionMask = 1; - CollisionLayer = 0; + CollisionLayer = PhysicsLayer.Throwing; _fallData.UseOrigin = false; } } @@ -1397,4 +1399,39 @@ yield return new WaitForSeconds(delayTime); cb(arg1,arg2, arg3); } + + /// + /// 将当前 ActivityObject 变成静态图像绘制到地面上, 用于优化渲染大量物体
+ /// 调用该函数后会排队进入渲染队列, 并且禁用所有行为, 当渲染完成后会销毁当前对象, 也就是调用 Destroy() 函数
+ ///
+ public void BecomesStaticImage() + { + if (AffiliationArea == null) + { + GD.PrintErr($"调用函数: BecomesStaticImage() 失败, 物体{Name}没有归属区域, 无法确定绘制到哪个ImageCanvas上"); + return; + } + + if (_processingBecomesStaticImage) + { + return; + } + + _processingBecomesStaticImage = true; + EnableBehavior = false; + var staticImageCanvas = AffiliationArea.RoomInfo.StaticImageCanvas; + var (x, y) = staticImageCanvas.ToImageCanvasPosition(GlobalPosition); + staticImageCanvas.CanvasSprite.DrawActivityObjectInCanvas(this, x, y, () => + { + Destroy(); + }); + } + + /// + /// 是否正在处理成为静态图片 + /// + public bool IsProcessingBecomesStaticImage() + { + return _processingBecomesStaticImage; + } } \ No newline at end of file diff --git a/DungeonShooting_Godot/src/framework/map/AffiliationArea.cs b/DungeonShooting_Godot/src/framework/map/AffiliationArea.cs index 6b0ae6d..89cf6e0 100644 --- a/DungeonShooting_Godot/src/framework/map/AffiliationArea.cs +++ b/DungeonShooting_Godot/src/framework/map/AffiliationArea.cs @@ -52,7 +52,7 @@ Monitoring = true; Monitorable = false; CollisionLayer = PhysicsLayer.None; - CollisionMask = PhysicsLayer.Props | PhysicsLayer.Player | PhysicsLayer.Enemy; + CollisionMask = PhysicsLayer.Props | PhysicsLayer.Player | PhysicsLayer.Enemy | PhysicsLayer.Shell | PhysicsLayer.Throwing; BodyEntered += OnBodyEntered; } diff --git a/DungeonShooting_Godot/src/framework/map/RoomInfo.cs b/DungeonShooting_Godot/src/framework/map/RoomInfo.cs index 600f1d1..16e45b0 100644 --- a/DungeonShooting_Godot/src/framework/map/RoomInfo.cs +++ b/DungeonShooting_Godot/src/framework/map/RoomInfo.cs @@ -72,7 +72,7 @@ /// /// 当前房间归属区域 /// - public AffiliationArea Affiliation; + public AffiliationArea AffiliationArea; /// /// 静态精灵绘制画布 diff --git a/DungeonShooting_Godot/src/framework/map/RoomStaticImageCanvas.cs b/DungeonShooting_Godot/src/framework/map/RoomStaticImageCanvas.cs index f89009b..a21a7c1 100644 --- a/DungeonShooting_Godot/src/framework/map/RoomStaticImageCanvas.cs +++ b/DungeonShooting_Godot/src/framework/map/RoomStaticImageCanvas.cs @@ -24,10 +24,9 @@ /// /// 将世界坐标转为画布下的坐标 /// - public Vector2I ToImageCanvasPosition(Vector2 pos) + public Vector2 ToImageCanvasPosition(Vector2 pos) { - pos = pos - CanvasSprite.GlobalPosition; - return new Vector2I((int)pos.X, (int)pos.Y); + return pos - CanvasSprite.GlobalPosition; } public void Destroy() diff --git a/DungeonShooting_Godot/src/framework/map/image/ImageCanvas.cs b/DungeonShooting_Godot/src/framework/map/image/ImageCanvas.cs index 68e1f15..842349b 100644 --- a/DungeonShooting_Godot/src/framework/map/image/ImageCanvas.cs +++ b/DungeonShooting_Godot/src/framework/map/image/ImageCanvas.cs @@ -2,6 +2,11 @@ using System; using Godot; +/// +/// 静态图像画布类, 用于处理游戏中大量静态物体的解决方案
+/// 将物体纹理绘直接绘制到画布上, 这样大大减少GPU开销, 从而提高帧率
+/// 图像旋转遵循完美像素 +///
public partial class ImageCanvas : Sprite2D, IDestroy { /// @@ -26,18 +31,6 @@ _canvas = Image.Create(width, height, false, Image.Format.Rgba8); _texture = ImageTexture.CreateFromImage(_canvas); - - // var w = _canvas.GetWidth(); - // var h = _canvas.GetHeight(); - // for (int i = 0; i < w; i++) - // { - // _canvas.SetPixel(i, h / 2, Colors.Green); - // } - // - // for (int j = 0; j < h; j++) - // { - // _canvas.SetPixel(w / 2, j, Colors.Green); - // } } public override void _Ready() @@ -47,7 +40,7 @@ } /// - /// 添加到预渲染队列中 + /// 将指定纹理添加到预渲染队列中, 完成后会调用 onDrawingComplete 回调函数 /// /// 需要渲染的纹理 /// 渲染材质, 不需要则传null @@ -58,10 +51,15 @@ /// 旋转中心点y /// 是否翻转y轴 /// 绘制完成的回调函数 - public void DrawImageInCanvas(Texture2D texture, Material material, int x, int y, float angle, int centerX, int centerY, bool flipY, Action onDrawingComplete = null) + public void DrawImageInCanvas(Texture2D texture, Material material, float x, float y, float angle, int centerX, int centerY, bool flipY, Action onDrawingComplete = null) + { + DrawImageInCanvas(texture, material, x, y, angle, centerX, centerY, flipY, true, onDrawingComplete); + } + private void DrawImageInCanvas(Texture2D texture, Material material, float x, float y, float angle, int centerX, int centerY, bool flipY, bool enableQueueCutting, Action onDrawingComplete) { var item = new ImageRenderData(); item.OnDrawingComplete = onDrawingComplete; + item.EnableQueueCutting = enableQueueCutting; item.ImageCanvas = this; item.SrcImage = texture.GetImage(); item.Material = material; @@ -75,8 +73,8 @@ { GD.PrintErr("警告: 图像高度大于 128, 旋转后像素点可能绘制到画布外导致像素丢失!"); } - item.X = x; - item.Y = y; + item.X = Mathf.RoundToInt(x); + item.Y = Mathf.RoundToInt(y); item.Rotation = Mathf.DegToRad(Mathf.RoundToInt(Utils.ConvertAngle(angle))); item.CenterX = centerX; item.CenterY = centerY; @@ -129,28 +127,69 @@ sinAngle + item.CenterY / sinAngle) / (sinAngle / cosAngle + cosAngle / sinAngle)) + 1; - _queueItems.Enqueue(item); + _queueItems.Add(item); } - public void DrawActivityObjectInCanvas(ActivityObject activityObject, Action onDrawingComplete = null) + /// + /// 将指定 ActivityObject 添加到预渲染队列中, 完成后会调用 onDrawingComplete 回调函数 + /// + /// 物体实例 + /// 离画布左上角x坐标 + /// 离画布左上角y坐标 + /// 绘制完成的回调 + public void DrawActivityObjectInCanvas(ActivityObject activityObject, float x, float y, Action onDrawingComplete = null) { - if (activityObject.AffiliationArea == null) + //是否翻转y轴 + var flipY = activityObject.Scale.Y < 0; + + var animatedSprite = activityObject.AnimatedSprite; + var animatedSpritePosition = animatedSprite.Position; + var ax = x + animatedSpritePosition.X; + var ay = y + animatedSpritePosition.X; + + //先绘制阴影 + var shadowSprite = activityObject.ShadowSprite; + var shadowSpriteTexture = activityObject.ShadowSprite.Texture; + if (shadowSpriteTexture != null) { - return; + var spriteOffset = shadowSprite.Offset; + var centerX = (int)-spriteOffset.X; + var centerY = (int)-spriteOffset.Y; + var angle = Utils.ConvertAngle(shadowSprite.GlobalRotationDegrees); + if (shadowSprite.Centered) + { + centerX += shadowSpriteTexture.GetWidth() / 2; + centerY += shadowSpriteTexture.GetHeight() / 2; + } + + DrawImageInCanvas( + shadowSprite.Texture, shadowSprite.Material, + ax + activityObject.ShadowOffset.X, ay + activityObject.ShadowOffset.Y, + angle, + centerX, centerY, flipY, + true, null + ); } - var staticImageCanvas = activityObject.AffiliationArea.RoomInfo.StaticImageCanvas; + + //再绘制纹理 var texture = activityObject.GetCurrentTexture(); if (texture != null) { - var pos = staticImageCanvas.ToImageCanvasPosition(activityObject.GlobalPosition); - var spriteOffset = activityObject.AnimatedSprite.Offset; + var spriteOffset = animatedSprite.Offset; var centerX = (int)-spriteOffset.X; var centerY = (int)-spriteOffset.Y; + if (animatedSprite.Centered) + { + centerX += texture.GetWidth() / 2; + centerY += texture.GetHeight() / 2; + } + //为了保证阴影在此之前渲染, 所以必须关闭插队渲染 DrawImageInCanvas( - texture, activityObject.AnimatedSprite.Material, - pos.X, pos.Y, - activityObject.AnimatedSprite.GlobalRotationDegrees, - centerX, centerY, false + texture, animatedSprite.Material, + ax, ay, + animatedSprite.GlobalRotationDegrees, + centerX, centerY, flipY, + false, onDrawingComplete ); } } diff --git a/DungeonShooting_Godot/src/framework/map/image/ImageCanvas_Static.cs b/DungeonShooting_Godot/src/framework/map/image/ImageCanvas_Static.cs index 65c3611..ea8de22 100644 --- a/DungeonShooting_Godot/src/framework/map/image/ImageCanvas_Static.cs +++ b/DungeonShooting_Godot/src/framework/map/image/ImageCanvas_Static.cs @@ -35,8 +35,8 @@ /// public static Vector2I RenderViewportSize { get; private set; } - //预渲染队列 - private static readonly Queue _queueItems = new Queue(); + //预渲染队列, 这里不用 Queue 是因为大图尝试添加到渲染队列可能失败, 为了不影响 + private static readonly List _queueItems = new List(); //渲染中的队列 private static readonly Queue _drawingQueueItems = new Queue(); //负责渲染的Sprite回收堆栈 @@ -146,6 +146,7 @@ { RenderViewport.RemoveChild(renderSprite.Sprite); _renderSpriteStack.Push(renderSprite); + renderSprite.Sprite.Material = null; } private static void OnFramePostDraw() @@ -186,7 +187,7 @@ { redrawCanvas.Add(item.ImageCanvas); //处理绘图 - HandleDrawing(index, image, item); + HandleDrawing(image, item); index++; if (item.OnDrawingComplete != null) { @@ -243,36 +244,40 @@ if (_queueItems.Count > 0) { var startTime = DateTime.Now; - List retryList = null; - var index = 0; + var hasFail = false; //执行绘制操作 - do + var index = 0; + for (var i = 0; i < _queueItems.Count; i++) { - var item = _queueItems.Dequeue(); + var item = _queueItems[i]; if (!item.ImageCanvas.IsDestroyed) { - //排队绘制 - if (HandleEnqueueDrawing(index, item)) + if (hasFail && !item.EnableQueueCutting) //禁用插队 { + continue; + } + //排队绘制 + if (HandleEnqueueDrawing(item)) + { + _queueItems.RemoveAt(i); + i--; index++; } - else //添加失败 + else //进入渲染队列失败 { - if (retryList == null) - { - retryList = new List(); - } - retryList.Add(item); + hasFail = true; } } - - } while (_queueItems.Count > 0 && (DateTime.Now - startTime).TotalMilliseconds < step2Time); - - if (retryList != null) - { - foreach (var renderData in retryList) + else { - _queueItems.Enqueue(renderData); + _queueItems.RemoveAt(i); + i--; + } + + //计算超时 + if ((DateTime.Now - startTime).TotalMilliseconds >= step2Time) + { + break; } } @@ -280,7 +285,7 @@ } } - private static void HandleDrawing(int index, Image image, ImageRenderData item) + private static void HandleDrawing(Image image, ImageRenderData item) { //截取Viewport像素点 item.ImageCanvas._canvas.BlendRect(image, @@ -293,7 +298,7 @@ } //处理排队绘制 - private static bool HandleEnqueueDrawing(int index, ImageRenderData item) + private static bool HandleEnqueueDrawing(ImageRenderData item) { var placeholder = FindNotchPlaceholder(item.RenderWidth); if (placeholder == null) //没有找到合适的位置 diff --git a/DungeonShooting_Godot/src/framework/map/image/ImageRenderData.cs b/DungeonShooting_Godot/src/framework/map/image/ImageRenderData.cs index 9d675a8..c6a4f79 100644 --- a/DungeonShooting_Godot/src/framework/map/image/ImageRenderData.cs +++ b/DungeonShooting_Godot/src/framework/map/image/ImageRenderData.cs @@ -49,6 +49,10 @@ /// 绘制完成的回调函数 ///
public Action OnDrawingComplete; + /// + /// 是否启用插队, 当进入渲染队列前, 如果前面有 image 因为过大而堵塞入口, 如果开启插队, 那么当前的 image 就会排到前面去尝试进入渲染队列 + /// + public bool EnableQueueCutting; //---------------------------------------------------------------------- /// diff --git a/DungeonShooting_Godot/src/game/PhysicsLayer.cs b/DungeonShooting_Godot/src/game/PhysicsLayer.cs index 118f604..c1c53ea 100644 --- a/DungeonShooting_Godot/src/game/PhysicsLayer.cs +++ b/DungeonShooting_Godot/src/game/PhysicsLayer.cs @@ -34,5 +34,13 @@ /// /// 在手上 /// - public const uint InHand = 0b1000000; + public const uint OnHand = 0b1000000; + /// + /// 弹壳 + /// + public const uint Shell = 0b10000000; + /// + /// 投抛中 + /// + public const uint Throwing = 0b100000000; } \ No newline at end of file diff --git a/DungeonShooting_Godot/src/game/activity/shell/Shell.cs b/DungeonShooting_Godot/src/game/activity/shell/Shell.cs index 310ee81..7496390 100644 --- a/DungeonShooting_Godot/src/game/activity/shell/Shell.cs +++ b/DungeonShooting_Godot/src/game/activity/shell/Shell.cs @@ -9,14 +9,24 @@ { public override void OnInit() { - base.OnInit(); ShadowOffset = new Vector2(0, 1); ThrowCollisionSize = new Vector2(5, 5); } - protected override void OnThrowOver() + protected override void Process(float delta) { - EnableBehavior = false; - Collision.QueueFree(); + //落地后将弹壳变为静态贴图 + if (!IsThrowing) + { + if (AffiliationArea != null) + { + BecomesStaticImage(); + } + else + { + GD.Print("弹壳投抛到画布外了, 强制消除..."); + Destroy(); + } + } } } \ No newline at end of file diff --git a/DungeonShooting_Godot/src/game/activity/weapon/Weapon.cs b/DungeonShooting_Godot/src/game/activity/weapon/Weapon.cs index 5347809..db52b77 100644 --- a/DungeonShooting_Godot/src/game/activity/weapon/Weapon.cs +++ b/DungeonShooting_Godot/src/game/activity/weapon/Weapon.cs @@ -1395,7 +1395,7 @@ AnimatedSprite.Position = new Vector2(-position.X, -position.Y); //修改层级 _tempLayer = CollisionLayer; - CollisionLayer = PhysicsLayer.InHand; + CollisionLayer = PhysicsLayer.OnHand; //清除 Ai 拾起标记 RemoveSign(SignNames.AiFindWeaponSign); OnPickUp(master); diff --git a/DungeonShooting_Godot/src/game/role/Role.cs b/DungeonShooting_Godot/src/game/role/Role.cs index 9df52a2..79ca40f 100644 --- a/DungeonShooting_Godot/src/game/role/Role.cs +++ b/DungeonShooting_Godot/src/game/role/Role.cs @@ -564,7 +564,7 @@ /// private void _OnPropsEnter(Node2D other) { - if (other is ActivityObject propObject && !propObject.CollisionWithMask(PhysicsLayer.InHand)) + if (other is ActivityObject propObject && !propObject.CollisionWithMask(PhysicsLayer.OnHand)) { if (!_interactiveItemList.Contains(propObject)) { diff --git a/DungeonShooting_Godot/src/game/room/DungeonManager.cs b/DungeonShooting_Godot/src/game/room/DungeonManager.cs index 7d1cadd..b8d3ed1 100644 --- a/DungeonShooting_Godot/src/game/room/DungeonManager.cs +++ b/DungeonShooting_Godot/src/game/room/DungeonManager.cs @@ -303,7 +303,7 @@ roomInfo.GetWorldPosition() + new Vector2(GameConfig.TileCellSize, GameConfig.TileCellSize), (roomInfo.Size - new Vector2I(2, 2)) * GameConfig.TileCellSize)); - roomInfo.Affiliation = affiliation; + roomInfo.AffiliationArea = affiliation; _world.AffiliationAreaRoot.AddChild(affiliation); }