diff --git a/DungeonShooting_Godot/excel/excelFile/ActivityBase.xlsx b/DungeonShooting_Godot/excel/excelFile/ActivityBase.xlsx index d3b7076..f8e954a 100644 --- a/DungeonShooting_Godot/excel/excelFile/ActivityBase.xlsx +++ b/DungeonShooting_Godot/excel/excelFile/ActivityBase.xlsx Binary files differ diff --git a/DungeonShooting_Godot/excel/excelFile/ActivityMaterial.xlsx b/DungeonShooting_Godot/excel/excelFile/ActivityMaterial.xlsx new file mode 100644 index 0000000..85c292e --- /dev/null +++ b/DungeonShooting_Godot/excel/excelFile/ActivityMaterial.xlsx Binary files differ diff --git a/DungeonShooting_Godot/excel/excelFile/AiAttackAttr.xlsx b/DungeonShooting_Godot/excel/excelFile/AiAttackAttr.xlsx index acd57ac..7fe6091 100644 --- a/DungeonShooting_Godot/excel/excelFile/AiAttackAttr.xlsx +++ b/DungeonShooting_Godot/excel/excelFile/AiAttackAttr.xlsx Binary files differ diff --git a/DungeonShooting_Godot/excel/excelFile/BulletBase.xlsx b/DungeonShooting_Godot/excel/excelFile/BulletBase.xlsx index 87cf1eb..85ac351 100644 --- a/DungeonShooting_Godot/excel/excelFile/BulletBase.xlsx +++ b/DungeonShooting_Godot/excel/excelFile/BulletBase.xlsx Binary files differ diff --git a/DungeonShooting_Godot/excel/excelFile/Sound.xlsx b/DungeonShooting_Godot/excel/excelFile/Sound.xlsx index 24e3964..6731e42 100644 --- a/DungeonShooting_Godot/excel/excelFile/Sound.xlsx +++ b/DungeonShooting_Godot/excel/excelFile/Sound.xlsx Binary files differ diff --git a/DungeonShooting_Godot/excel/excelFile/WeaponBase.xlsx b/DungeonShooting_Godot/excel/excelFile/WeaponBase.xlsx index 22f8761..3ebfc6c 100644 --- a/DungeonShooting_Godot/excel/excelFile/WeaponBase.xlsx +++ b/DungeonShooting_Godot/excel/excelFile/WeaponBase.xlsx Binary files differ diff --git a/DungeonShooting_Godot/prefab/bullet/normal/Bullet0001.tscn b/DungeonShooting_Godot/prefab/bullet/normal/Bullet0001.tscn index 20aab1f..740c1cd 100644 --- a/DungeonShooting_Godot/prefab/bullet/normal/Bullet0001.tscn +++ b/DungeonShooting_Godot/prefab/bullet/normal/Bullet0001.tscn @@ -43,7 +43,7 @@ [node name="Bullet0001" type="CharacterBody2D" node_paths=PackedStringArray("CollisionArea", "ShadowSprite", "AnimatedSprite", "Collision")] collision_layer = 2 script = ExtResource("1_3d3df") -CollisionArea = NodePath("CollisionArea") +CollisionArea = NodePath("AnimatedSprite/CollisionArea") ShadowSprite = NodePath("ShadowSprite") AnimatedSprite = NodePath("AnimatedSprite") Collision = NodePath("Collision") @@ -57,13 +57,12 @@ material = SubResource("ShaderMaterial_qhkgc") sprite_frames = SubResource("SpriteFrames_5wvmf") -[node name="CollisionArea" type="Area2D" parent="."] -visible = false +[node name="CollisionArea" type="Area2D" parent="AnimatedSprite"] collision_layer = 0 collision_mask = 0 monitorable = false -[node name="CollisionShape2D" type="CollisionShape2D" parent="CollisionArea"] +[node name="CollisionShape2D" type="CollisionShape2D" parent="AnimatedSprite/CollisionArea"] position = Vector2(2.93353, 0) shape = SubResource("RectangleShape2D_lcqb8") diff --git a/DungeonShooting_Godot/prefab/bullet/normal/Bullet0002.tscn b/DungeonShooting_Godot/prefab/bullet/normal/Bullet0002.tscn index 5366ce1..b1a1813 100644 --- a/DungeonShooting_Godot/prefab/bullet/normal/Bullet0002.tscn +++ b/DungeonShooting_Godot/prefab/bullet/normal/Bullet0002.tscn @@ -35,7 +35,7 @@ [node name="Bullet0002" type="CharacterBody2D" node_paths=PackedStringArray("CollisionArea", "ShadowSprite", "AnimatedSprite", "Collision")] collision_layer = 2 script = ExtResource("1_hepay") -CollisionArea = NodePath("CollisionArea") +CollisionArea = NodePath("AnimatedSprite/CollisionArea") ShadowSprite = NodePath("ShadowSprite") AnimatedSprite = NodePath("AnimatedSprite") Collision = NodePath("Collision") @@ -49,13 +49,13 @@ material = SubResource("ShaderMaterial_p0wfd") sprite_frames = ExtResource("3_ldd0h") -[node name="CollisionArea" type="Area2D" parent="."] +[node name="CollisionArea" type="Area2D" parent="AnimatedSprite"] visible = false collision_layer = 0 collision_mask = 0 monitorable = false -[node name="CollisionShape2D" type="CollisionShape2D" parent="CollisionArea"] +[node name="CollisionShape2D" type="CollisionShape2D" parent="AnimatedSprite/CollisionArea"] position = Vector2(-2.38419e-07, 0) shape = SubResource("CircleShape2D_0vxfv") diff --git a/DungeonShooting_Godot/prefab/bullet/normal/Bullet0003.tscn b/DungeonShooting_Godot/prefab/bullet/normal/Bullet0003.tscn index 18ea61f..65b9e2a 100644 --- a/DungeonShooting_Godot/prefab/bullet/normal/Bullet0003.tscn +++ b/DungeonShooting_Godot/prefab/bullet/normal/Bullet0003.tscn @@ -32,7 +32,7 @@ [node name="Bullet0003" type="CharacterBody2D" node_paths=PackedStringArray("CollisionArea", "ShadowSprite", "AnimatedSprite", "Collision")] collision_layer = 2 script = ExtResource("1_h6lfm") -CollisionArea = NodePath("CollisionArea") +CollisionArea = NodePath("AnimatedSprite/CollisionArea") ShadowSprite = NodePath("ShadowSprite") AnimatedSprite = NodePath("AnimatedSprite") Collision = NodePath("Collision") @@ -46,13 +46,13 @@ material = SubResource("ShaderMaterial_p0wfd") sprite_frames = ExtResource("3_qvo0u") -[node name="CollisionArea" type="Area2D" parent="."] +[node name="CollisionArea" type="Area2D" parent="AnimatedSprite"] visible = false collision_layer = 0 collision_mask = 0 monitorable = false -[node name="CollisionShape2D" type="CollisionShape2D" parent="CollisionArea"] +[node name="CollisionShape2D" type="CollisionShape2D" parent="AnimatedSprite/CollisionArea"] position = Vector2(1, 0) shape = SubResource("RectangleShape2D_c0onq") diff --git a/DungeonShooting_Godot/prefab/bullet/normal/Bullet0004.tscn b/DungeonShooting_Godot/prefab/bullet/normal/Bullet0004.tscn index 7e826d4..844689a 100644 --- a/DungeonShooting_Godot/prefab/bullet/normal/Bullet0004.tscn +++ b/DungeonShooting_Godot/prefab/bullet/normal/Bullet0004.tscn @@ -1,6 +1,6 @@ [gd_scene load_steps=7 format=3 uid="uid://d0h4xfi1oqf1l"] -[ext_resource type="Script" path="res://src/game/activity/bullet/normal/Bullet.cs" id="1_teoyi"] +[ext_resource type="Script" path="res://src/game/activity/bullet/normal/BoomBullet.cs" id="1_1jbgr"] [ext_resource type="Shader" path="res://resource/material/Blend.gdshader" id="2_w1qob"] [ext_resource type="SpriteFrames" uid="uid://d3vma1qjo478l" path="res://resource/spriteFrames/bullet/Bullet0004.tres" id="3_bttus"] @@ -31,8 +31,8 @@ [node name="Bullet0003" type="CharacterBody2D" node_paths=PackedStringArray("CollisionArea", "ShadowSprite", "AnimatedSprite", "Collision")] collision_layer = 2 -script = ExtResource("1_teoyi") -CollisionArea = NodePath("CollisionArea") +script = ExtResource("1_1jbgr") +CollisionArea = NodePath("AnimatedSprite/CollisionArea") ShadowSprite = NodePath("ShadowSprite") AnimatedSprite = NodePath("AnimatedSprite") Collision = NodePath("Collision") @@ -45,14 +45,14 @@ material = SubResource("ShaderMaterial_p0wfd") sprite_frames = ExtResource("3_bttus") animation = &"move" -frame_progress = 0.167868 +frame_progress = 0.57852 -[node name="CollisionArea" type="Area2D" parent="."] +[node name="CollisionArea" type="Area2D" parent="AnimatedSprite"] collision_layer = 0 collision_mask = 0 monitorable = false -[node name="CollisionShape2D" type="CollisionShape2D" parent="CollisionArea"] +[node name="CollisionShape2D" type="CollisionShape2D" parent="AnimatedSprite/CollisionArea"] position = Vector2(1, 0) shape = SubResource("RectangleShape2D_c0onq") diff --git a/DungeonShooting_Godot/prefab/map/RoomDoor_E.tscn b/DungeonShooting_Godot/prefab/map/RoomDoor_E.tscn index 3a07eb2..2631c7c 100644 --- a/DungeonShooting_Godot/prefab/map/RoomDoor_E.tscn +++ b/DungeonShooting_Godot/prefab/map/RoomDoor_E.tscn @@ -14,6 +14,7 @@ shader_parameter/show_outline = false shader_parameter/outline_color = Color(0, 0, 0, 1) shader_parameter/outline_rainbow = false +shader_parameter/outline_use_blend = true [sub_resource type="ShaderMaterial" id="ShaderMaterial_t4ayq"] resource_local_to_scene = true @@ -24,6 +25,7 @@ shader_parameter/show_outline = false shader_parameter/outline_color = Color(0, 0, 0, 1) shader_parameter/outline_rainbow = false +shader_parameter/outline_use_blend = true [sub_resource type="RectangleShape2D" id="RectangleShape2D_opsb6"] resource_local_to_scene = true diff --git a/DungeonShooting_Godot/prefab/map/RoomDoor_N.tscn b/DungeonShooting_Godot/prefab/map/RoomDoor_N.tscn index 52a7d64..0c6565e 100644 --- a/DungeonShooting_Godot/prefab/map/RoomDoor_N.tscn +++ b/DungeonShooting_Godot/prefab/map/RoomDoor_N.tscn @@ -13,6 +13,7 @@ shader_parameter/show_outline = false shader_parameter/outline_color = Color(0, 0, 0, 1) shader_parameter/outline_rainbow = false +shader_parameter/outline_use_blend = true [sub_resource type="ShaderMaterial" id="ShaderMaterial_t4ayq"] resource_local_to_scene = true @@ -23,6 +24,7 @@ shader_parameter/show_outline = false shader_parameter/outline_color = Color(0, 0, 0, 1) shader_parameter/outline_rainbow = false +shader_parameter/outline_use_blend = true [sub_resource type="RectangleShape2D" id="RectangleShape2D_opsb6"] resource_local_to_scene = true diff --git a/DungeonShooting_Godot/prefab/map/RoomDoor_S.tscn b/DungeonShooting_Godot/prefab/map/RoomDoor_S.tscn index 6c07aba..a2996d7 100644 --- a/DungeonShooting_Godot/prefab/map/RoomDoor_S.tscn +++ b/DungeonShooting_Godot/prefab/map/RoomDoor_S.tscn @@ -13,6 +13,7 @@ shader_parameter/show_outline = false shader_parameter/outline_color = Color(0, 0, 0, 1) shader_parameter/outline_rainbow = false +shader_parameter/outline_use_blend = true [sub_resource type="ShaderMaterial" id="ShaderMaterial_t4ayq"] resource_local_to_scene = true @@ -23,6 +24,7 @@ shader_parameter/show_outline = false shader_parameter/outline_color = Color(0, 0, 0, 1) shader_parameter/outline_rainbow = false +shader_parameter/outline_use_blend = true [sub_resource type="RectangleShape2D" id="RectangleShape2D_opsb6"] resource_local_to_scene = true diff --git a/DungeonShooting_Godot/prefab/map/RoomDoor_W.tscn b/DungeonShooting_Godot/prefab/map/RoomDoor_W.tscn index d3c5a08..727c632 100644 --- a/DungeonShooting_Godot/prefab/map/RoomDoor_W.tscn +++ b/DungeonShooting_Godot/prefab/map/RoomDoor_W.tscn @@ -14,6 +14,7 @@ shader_parameter/show_outline = false shader_parameter/outline_color = Color(0, 0, 0, 1) shader_parameter/outline_rainbow = false +shader_parameter/outline_use_blend = true [sub_resource type="ShaderMaterial" id="ShaderMaterial_t4ayq"] resource_local_to_scene = true @@ -24,6 +25,7 @@ shader_parameter/show_outline = false shader_parameter/outline_color = Color(0, 0, 0, 1) shader_parameter/outline_rainbow = false +shader_parameter/outline_use_blend = true [sub_resource type="RectangleShape2D" id="RectangleShape2D_2ko2r"] resource_local_to_scene = true diff --git a/DungeonShooting_Godot/resource/config/ActivityBase.json b/DungeonShooting_Godot/resource/config/ActivityBase.json index eaaebd3..2758f5e 100644 --- a/DungeonShooting_Godot/resource/config/ActivityBase.json +++ b/DungeonShooting_Godot/resource/config/ActivityBase.json @@ -6,6 +6,7 @@ "Intro": "\u73A9\u5BB6", "Details": "", "IsStatic": false, + "__Material": "", "Prefab": "res://prefab/role/Role0001.tscn", "Icon": "res://resource/sprite/role/role0001/Role0001_Icon.png", "ShowInMapEditor": false @@ -17,6 +18,7 @@ "Intro": "\u654C\u4EBA", "Details": "", "IsStatic": false, + "__Material": "", "Prefab": "res://prefab/role/Enemy0001.tscn", "Icon": "res://resource/sprite/role/enemy0001/enemy0001_Icon.png", "ShowInMapEditor": true @@ -28,6 +30,7 @@ "Intro": "", "Details": "", "IsStatic": false, + "__Material": "", "Prefab": "res://prefab/weapon/Weapon0001.tscn", "Icon": "res://resource/sprite/weapon/weapon0001/Weapon0001.png", "ShowInMapEditor": true @@ -39,6 +42,7 @@ "Intro": "", "Details": "", "IsStatic": false, + "__Material": "", "Prefab": "res://prefab/weapon/Weapon0002.tscn", "Icon": "res://resource/sprite/weapon/weapon0002/Weapon0002.png", "ShowInMapEditor": true @@ -50,6 +54,7 @@ "Intro": "", "Details": "", "IsStatic": false, + "__Material": "", "Prefab": "res://prefab/weapon/Weapon0003.tscn", "Icon": "res://resource/sprite/weapon/weapon0003/Weapon0003.png", "ShowInMapEditor": true @@ -61,6 +66,7 @@ "Intro": "", "Details": "", "IsStatic": false, + "__Material": "", "Prefab": "res://prefab/weapon/Weapon0004.tscn", "Icon": "res://resource/sprite/weapon/knife1.png", "ShowInMapEditor": true @@ -72,6 +78,7 @@ "Intro": "", "Details": "", "IsStatic": false, + "__Material": "", "Prefab": "res://prefab/weapon/Weapon0005.tscn", "Icon": "res://resource/sprite/weapon/weapon0005/Weapon0005.png", "ShowInMapEditor": true @@ -83,6 +90,7 @@ "Intro": "", "Details": "", "IsStatic": false, + "__Material": "", "Prefab": "res://prefab/weapon/Weapon0006.tscn", "Icon": "res://resource/sprite/weapon/weapon0006/Weapon0006.png", "ShowInMapEditor": true @@ -94,6 +102,7 @@ "Intro": "", "Details": "", "IsStatic": false, + "__Material": "", "Prefab": "res://prefab/weapon/Weapon0007.tscn", "Icon": "res://resource/sprite/weapon/weapon0007/Weapon0007.png", "ShowInMapEditor": true @@ -105,6 +114,7 @@ "Intro": "", "Details": "", "IsStatic": false, + "__Material": "", "Prefab": "res://prefab/weapon/Weapon0008.tscn", "Icon": "res://resource/sprite/weapon/weapon0008/Weapon0008.png", "ShowInMapEditor": true @@ -116,6 +126,7 @@ "Intro": "", "Details": "", "IsStatic": false, + "__Material": "", "Prefab": "res://prefab/weapon/Weapon0009.tscn", "Icon": "res://resource/sprite/weapon/weapon0009/Weapon0009.png", "ShowInMapEditor": true @@ -127,6 +138,7 @@ "Intro": "", "Details": "", "IsStatic": false, + "__Material": "", "Prefab": "res://prefab/bullet/normal/Bullet0001.tscn", "Icon": "", "ShowInMapEditor": false @@ -138,6 +150,7 @@ "Intro": "", "Details": "", "IsStatic": false, + "__Material": "", "Prefab": "res://prefab/bullet/normal/Bullet0002.tscn", "Icon": "", "ShowInMapEditor": false @@ -149,6 +162,7 @@ "Intro": "", "Details": "", "IsStatic": false, + "__Material": "", "Prefab": "res://prefab/bullet/normal/Bullet0003.tscn", "Icon": "", "ShowInMapEditor": false @@ -156,10 +170,11 @@ { "Id": "bullet0004", "Type": 6, - "Name": "", + "Name": "\u69B4\u5F39\u70AE", "Intro": "", "Details": "", "IsStatic": false, + "__Material": "0002", "Prefab": "res://prefab/bullet/normal/Bullet0004.tscn", "Icon": "", "ShowInMapEditor": false @@ -171,6 +186,7 @@ "Intro": "", "Details": "", "IsStatic": false, + "__Material": "", "Prefab": "res://prefab/shell/Shell0001.tscn", "Icon": "", "ShowInMapEditor": false @@ -182,6 +198,7 @@ "Intro": "", "Details": "", "IsStatic": false, + "__Material": "", "Prefab": "res://prefab/shell/Shell0002.tscn", "Icon": "", "ShowInMapEditor": false @@ -193,6 +210,7 @@ "Intro": "", "Details": "", "IsStatic": false, + "__Material": "", "Prefab": "res://prefab/shell/Shell0003.tscn", "Icon": "", "ShowInMapEditor": false @@ -204,6 +222,7 @@ "Intro": "\u654C\u4EBA\u6B7B\u4EA1\u788E\u7247", "Details": "", "IsStatic": false, + "__Material": "", "Prefab": "res://prefab/effect/enemy/Effect0001.tscn", "Icon": "", "ShowInMapEditor": false @@ -215,6 +234,7 @@ "Intro": "\u63D0\u9AD8\u79FB\u52A8\u901F\u5EA6", "Details": "", "IsStatic": false, + "__Material": "", "Prefab": "res://prefab/effect/enemy/Effect0001.tscn", "Icon": "res://resource/sprite/prop/buff/BuffProp0001.png", "ShowInMapEditor": true @@ -226,6 +246,7 @@ "Intro": "\u63D0\u9AD8\u8840\u91CF\u4E0A\u9650", "Details": "", "IsStatic": false, + "__Material": "", "Prefab": "res://prefab/prop/buff/BuffProp0002.tscn", "Icon": "res://resource/sprite/prop/buff/BuffProp0002.png", "ShowInMapEditor": true @@ -237,6 +258,7 @@ "Intro": "\u53EF\u4EE5\u62B5\u6321\u5B50\u5F39\uFF0C\u968F\u65F6\u95F4\u63A8\u79FB\u81EA\u52A8\u6062\u590D", "Details": "", "IsStatic": false, + "__Material": "", "Prefab": "res://prefab/prop/buff/BuffProp0003.tscn", "Icon": "res://resource/sprite/prop/buff/BuffProp0003.png", "ShowInMapEditor": true @@ -248,6 +270,7 @@ "Intro": "\u63D0\u9AD8\u62A4\u76FE\u6062\u590D\u901F\u5EA6", "Details": "", "IsStatic": false, + "__Material": "", "Prefab": "res://prefab/prop/buff/BuffProp0004.tscn", "Icon": "res://resource/sprite/prop/buff/BuffProp0004.png", "ShowInMapEditor": true @@ -259,6 +282,7 @@ "Intro": "\u63D0\u9AD8\u5B50\u5F39\u4F24\u5BB3", "Details": "", "IsStatic": false, + "__Material": "", "Prefab": "res://prefab/prop/buff/BuffProp0005.tscn", "Icon": "res://resource/sprite/prop/buff/BuffProp0005.png", "ShowInMapEditor": true @@ -270,6 +294,7 @@ "Intro": "\u53D7\u4F24\u540E\u5EF6\u957F\u65E0\u654C\u65F6\u95F4", "Details": "", "IsStatic": false, + "__Material": "", "Prefab": "res://prefab/prop/buff/BuffProp0006.tscn", "Icon": "res://resource/sprite/prop/buff/BuffProp0006.png", "ShowInMapEditor": true @@ -281,6 +306,7 @@ "Intro": "\u53D7\u4F24\u65F6\u6709\u4E00\u5B9A\u6982\u7387\u62B5\u6D88\u4F24\u5BB3", "Details": "", "IsStatic": false, + "__Material": "", "Prefab": "res://prefab/prop/buff/BuffProp0007.tscn", "Icon": "res://resource/sprite/prop/buff/BuffProp0007.png", "ShowInMapEditor": true @@ -292,6 +318,7 @@ "Intro": "\u63D0\u9AD8\u6B66\u5668\u7CBE\u51C6\u5EA6", "Details": "", "IsStatic": false, + "__Material": "", "Prefab": "res://prefab/prop/buff/BuffProp0008.tscn", "Icon": "res://resource/sprite/prop/buff/BuffProp0008.png", "ShowInMapEditor": true @@ -303,6 +330,7 @@ "Intro": "\u63D0\u9AD8\u5B50\u5F39\u901F\u5EA6\u548C\u5C04\u7A0B", "Details": "", "IsStatic": false, + "__Material": "", "Prefab": "res://prefab/prop/buff/BuffProp0009.tscn", "Icon": "res://resource/sprite/prop/buff/BuffProp0009.png", "ShowInMapEditor": true @@ -314,6 +342,7 @@ "Intro": "\u5B50\u5F39\u6570\u91CF\u7FFB\u500D, \u4F46\u662F\u7CBE\u51C6\u5EA6\u548C\u4F24\u5BB3\u964D\u4F4E", "Details": "", "IsStatic": false, + "__Material": "", "Prefab": "res://prefab/prop/buff/BuffProp0010.tscn", "Icon": "res://resource/sprite/prop/buff/BuffProp0010.png", "ShowInMapEditor": true @@ -325,6 +354,7 @@ "Intro": "\u4F7F\u7528\u540E\u56DE\u590D\u4E00\u9897\u7EA2\u5FC3", "Details": "", "IsStatic": false, + "__Material": "", "Prefab": "res://prefab/prop/active/ActiveProp5000.tscn", "Icon": "res://resource/sprite/prop/active/ActiveProp5000.png", "ShowInMapEditor": true @@ -336,6 +366,7 @@ "Intro": "\u4F7F\u7528\u540E\u8865\u5145\u5F53\u524D\u6B66\u5668\u5907\u7528\u5F39\u836F", "Details": "", "IsStatic": false, + "__Material": "", "Prefab": "res://prefab/prop/active/ActiveProp5001.tscn", "Icon": "res://resource/sprite/prop/active/ActiveProp5001.png", "ShowInMapEditor": true @@ -347,6 +378,7 @@ "Intro": "\u5730\u7262\u623F\u95F4\u7684\u95E8(\u4E1C\u4FA7)", "Details": "", "IsStatic": false, + "__Material": "", "Prefab": "res://prefab/map/RoomDoor_E.tscn", "Icon": "", "ShowInMapEditor": false @@ -358,6 +390,7 @@ "Intro": "\u5730\u7262\u623F\u95F4\u7684\u95E8(\u897F\u4FA7)", "Details": "", "IsStatic": true, + "__Material": "", "Prefab": "res://prefab/map/RoomDoor_W.tscn", "Icon": "", "ShowInMapEditor": false @@ -369,6 +402,7 @@ "Intro": "\u5730\u7262\u623F\u95F4\u7684\u95E8(\u5357\u4FA7)", "Details": "", "IsStatic": true, + "__Material": "", "Prefab": "res://prefab/map/RoomDoor_S.tscn", "Icon": "", "ShowInMapEditor": false @@ -380,6 +414,7 @@ "Intro": "\u5730\u7262\u623F\u95F4\u7684\u95E8(\u5317\u4FA7)", "Details": "", "IsStatic": true, + "__Material": "", "Prefab": "res://prefab/map/RoomDoor_N.tscn", "Icon": "", "ShowInMapEditor": false diff --git a/DungeonShooting_Godot/resource/config/ActivityMaterial.json b/DungeonShooting_Godot/resource/config/ActivityMaterial.json new file mode 100644 index 0000000..a6cffda --- /dev/null +++ b/DungeonShooting_Godot/resource/config/ActivityMaterial.json @@ -0,0 +1,24 @@ +[ + { + "Id": "0001", + "Remark": "\u9ED8\u8BA4\u6750\u8D28\u5C5E\u6027", + "Friction": 140, + "RotationFriction": 140, + "Bounce": true, + "BounceStrength": 0.5, + "FallBounceStrength": 0.5, + "FallBounceSpeed": 0.75, + "FallBounceRotation": 0.5 + }, + { + "Id": "0002", + "Remark": "\u7403\u4F53\u6750\u8D28\uFF0C\u6469\u64E6\u529B\u8F83\u4F4E", + "Friction": 40, + "RotationFriction": 40, + "Bounce": true, + "BounceStrength": 0.7, + "FallBounceStrength": 0.7, + "FallBounceSpeed": 0.85, + "FallBounceRotation": 0.85 + } +] \ No newline at end of file diff --git a/DungeonShooting_Godot/resource/config/BulletBase.json b/DungeonShooting_Godot/resource/config/BulletBase.json index 9186624..d4f399d 100644 --- a/DungeonShooting_Godot/resource/config/BulletBase.json +++ b/DungeonShooting_Godot/resource/config/BulletBase.json @@ -24,7 +24,14 @@ 300, 400 ], - "UseGravity": false + "UseGravity": false, + "VerticalSpeed": [ + 0 + ], + "BounceCount": [ + 0 + ], + "StrikeDestroy": true }, { "Id": "0002", @@ -52,7 +59,14 @@ 200, 250 ], - "UseGravity": false + "UseGravity": false, + "VerticalSpeed": [ + 0 + ], + "BounceCount": [ + 0 + ], + "StrikeDestroy": true }, { "Id": "0003", @@ -79,7 +93,14 @@ 300, 400 ], - "UseGravity": false + "UseGravity": false, + "VerticalSpeed": [ + 0 + ], + "BounceCount": [ + 0 + ], + "StrikeDestroy": true }, { "Id": "0004", @@ -106,7 +127,14 @@ 600, 600 ], - "UseGravity": false + "UseGravity": false, + "VerticalSpeed": [ + 0 + ], + "BounceCount": [ + 0 + ], + "StrikeDestroy": true }, { "Id": "0005", @@ -123,8 +151,8 @@ 0 ], "SpeedRange": [ - 30, - 30 + 180, + 180 ], "LifeTimeRange": [ -1 @@ -133,7 +161,14 @@ 270, 360 ], - "UseGravity": false + "UseGravity": true, + "VerticalSpeed": [ + 70 + ], + "BounceCount": [ + 999 + ], + "StrikeDestroy": true }, { "Id": "1001", @@ -160,7 +195,12 @@ 600, 600 ], - "UseGravity": false + "UseGravity": false, + "VerticalSpeed": null, + "BounceCount": [ + 0 + ], + "StrikeDestroy": false }, { "Id": "2001", @@ -185,6 +225,9 @@ "DistanceRange": [ 35 ], - "UseGravity": false + "UseGravity": false, + "VerticalSpeed": null, + "BounceCount": null, + "StrikeDestroy": false } ] \ No newline at end of file diff --git a/DungeonShooting_Godot/resource/config/WeaponBase.json b/DungeonShooting_Godot/resource/config/WeaponBase.json index 1f569e1..e3e7806 100644 --- a/DungeonShooting_Godot/resource/config/WeaponBase.json +++ b/DungeonShooting_Godot/resource/config/WeaponBase.json @@ -1244,7 +1244,7 @@ "UpliftAngle": 13, "DefaultAngle": 0, "UpliftAngleRestore": 1, - "FireEffect": "res://prefab/effect/weapon/ShotFire2.tscn", + "FireEffect": "res://prefab/effect/weapon/ShotFire.tscn", "__Bullet": "0005", "__Shell": "", "ThrowShellDelayTime": 0, diff --git a/DungeonShooting_Godot/src/config/ExcelConfig.cs b/DungeonShooting_Godot/src/config/ExcelConfig.cs index 931fc29..f9d7eaf 100644 --- a/DungeonShooting_Godot/src/config/ExcelConfig.cs +++ b/DungeonShooting_Godot/src/config/ExcelConfig.cs @@ -17,6 +17,15 @@ public static Dictionary ActivityBase_Map { get; private set; } /// + /// ActivityMaterial.xlsx表数据集合, 以 List 形式存储, 数据顺序与 Excel 表相同 + /// + public static List ActivityMaterial_List { get; private set; } + /// + /// ActivityMaterial.xlsx表数据集合, 里 Map 形式存储, key 为 Id + /// + public static Dictionary ActivityMaterial_Map { get; private set; } + + /// /// AiAttackAttr.xlsx表数据集合, 以 List 形式存储, 数据顺序与 Excel 表相同 /// public static List AiAttackAttr_List { get; private set; } @@ -63,11 +72,13 @@ _init = true; _InitActivityBaseConfig(); + _InitActivityMaterialConfig(); _InitAiAttackAttrConfig(); _InitBulletBaseConfig(); _InitSoundConfig(); _InitWeaponBaseConfig(); + _InitActivityBaseRef(); _InitWeaponBaseRef(); } private static void _InitActivityBaseConfig() @@ -75,7 +86,7 @@ try { var text = _ReadConfigAsText("res://resource/config/ActivityBase.json"); - ActivityBase_List = JsonSerializer.Deserialize>(text); + ActivityBase_List = new List(JsonSerializer.Deserialize>(text)); ActivityBase_Map = new Dictionary(); foreach (var item in ActivityBase_List) { @@ -88,6 +99,24 @@ throw new Exception("初始化表'ActivityBase'失败!"); } } + private static void _InitActivityMaterialConfig() + { + try + { + var text = _ReadConfigAsText("res://resource/config/ActivityMaterial.json"); + ActivityMaterial_List = JsonSerializer.Deserialize>(text); + ActivityMaterial_Map = new Dictionary(); + foreach (var item in ActivityMaterial_List) + { + ActivityMaterial_Map.Add(item.Id, item); + } + } + catch (Exception e) + { + GD.PrintErr(e.ToString()); + throw new Exception("初始化表'ActivityMaterial'失败!"); + } + } private static void _InitAiAttackAttrConfig() { try @@ -161,6 +190,25 @@ } } + private static void _InitActivityBaseRef() + { + foreach (Ref_ActivityBase item in ActivityBase_List) + { + try + { + if (!string.IsNullOrEmpty(item.__Material)) + { + item.Material = ActivityMaterial_Map[item.__Material]; + } + + } + catch (Exception e) + { + GD.PrintErr(e.ToString()); + throw new Exception("初始化'ActivityBase'引用其他表数据失败, 当前行id: " + item.Id); + } + } + } private static void _InitWeaponBaseRef() { foreach (Ref_WeaponBase item in WeaponBase_List) diff --git a/DungeonShooting_Godot/src/config/ExcelConfig_ActivityBase.cs b/DungeonShooting_Godot/src/config/ExcelConfig_ActivityBase.cs index ffae5fd..76d7bfb 100644 --- a/DungeonShooting_Godot/src/config/ExcelConfig_ActivityBase.cs +++ b/DungeonShooting_Godot/src/config/ExcelConfig_ActivityBase.cs @@ -55,6 +55,12 @@ public bool IsStatic; /// + /// 物体使用交互材质
+ /// 如果不填,则默认使用id为0001的材质 + ///
+ public ActivityMaterial Material; + + /// /// 物体预制场景路径, 场景根节点必须是ActivityObject子类 /// [JsonInclude] @@ -85,10 +91,17 @@ inst.Intro = Intro; inst.Details = Details; inst.IsStatic = IsStatic; + inst.Material = Material; inst.Prefab = Prefab; inst.Icon = Icon; inst.ShowInMapEditor = ShowInMapEditor; return inst; } } + private class Ref_ActivityBase : ActivityBase + { + [JsonInclude] + public string __Material; + + } } \ No newline at end of file diff --git a/DungeonShooting_Godot/src/config/ExcelConfig_ActivityMaterial.cs b/DungeonShooting_Godot/src/config/ExcelConfig_ActivityMaterial.cs new file mode 100644 index 0000000..d0d756b --- /dev/null +++ b/DungeonShooting_Godot/src/config/ExcelConfig_ActivityMaterial.cs @@ -0,0 +1,82 @@ +using System.Text.Json.Serialization; +using System.Collections.Generic; + +namespace Config; + +public static partial class ExcelConfig +{ + public class ActivityMaterial + { + /// + /// 表Id + /// + [JsonInclude] + public string Id; + + /// + /// 备注 + /// + [JsonInclude] + public string Remark; + + /// + /// 摩擦力 + /// + [JsonInclude] + public float Friction; + + /// + /// 旋转摩擦力 + /// + [JsonInclude] + public float RotationFriction; + + /// + /// 落地之后是否回弹 + /// + [JsonInclude] + public bool Bounce; + + /// + /// 物体水平回弹强度 + /// + [JsonInclude] + public float BounceStrength; + + /// + /// 物体下坠回弹的强度 + /// + [JsonInclude] + public float FallBounceStrength; + + /// + /// 物体下坠回弹后的运动速度衰比例 + /// + [JsonInclude] + public float FallBounceSpeed; + + /// + /// 物体下坠回弹后的旋转速度衰减比例 + /// + [JsonInclude] + public float FallBounceRotation; + + /// + /// 返回浅拷贝出的新对象 + /// + public ActivityMaterial Clone() + { + var inst = new ActivityMaterial(); + inst.Id = Id; + inst.Remark = Remark; + inst.Friction = Friction; + inst.RotationFriction = RotationFriction; + inst.Bounce = Bounce; + inst.BounceStrength = BounceStrength; + inst.FallBounceStrength = FallBounceStrength; + inst.FallBounceSpeed = FallBounceSpeed; + inst.FallBounceRotation = FallBounceRotation; + return inst; + } + } +} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/config/ExcelConfig_BulletBase.cs b/DungeonShooting_Godot/src/config/ExcelConfig_BulletBase.cs index 6514d3f..0f0dcb0 100644 --- a/DungeonShooting_Godot/src/config/ExcelConfig_BulletBase.cs +++ b/DungeonShooting_Godot/src/config/ExcelConfig_BulletBase.cs @@ -85,12 +85,34 @@ /// /// 是否开启重力下坠
- /// 只有Type为1时才需要填写 + /// 只有Type为1时有效 ///
[JsonInclude] public bool UseGravity; /// + /// 初始纵轴速度区间
+ /// 只有Type为1时有效
+ /// 格式为[value]或者[min,max] + ///
+ [JsonInclude] + public float[] VerticalSpeed; + + /// + /// 反弹次数区间
+ /// 只有Type为1或2时有效
+ /// 格式为[value]或者[min,max] + ///
+ [JsonInclude] + public int[] BounceCount; + + /// + /// 在还有剩余反弹次数时撞到玩家时是否销毁子弹 + /// + [JsonInclude] + public bool StrikeDestroy; + + /// /// 返回浅拷贝出的新对象 /// public BulletBase Clone() @@ -107,6 +129,9 @@ inst.LifeTimeRange = LifeTimeRange; inst.DistanceRange = DistanceRange; inst.UseGravity = UseGravity; + inst.VerticalSpeed = VerticalSpeed; + inst.BounceCount = BounceCount; + inst.StrikeDestroy = StrikeDestroy; return inst; } } diff --git a/DungeonShooting_Godot/src/framework/activity/ActivityMaterial.cs b/DungeonShooting_Godot/src/framework/activity/ActivityMaterial.cs deleted file mode 100644 index 9cd5669..0000000 --- a/DungeonShooting_Godot/src/framework/activity/ActivityMaterial.cs +++ /dev/null @@ -1,36 +0,0 @@ - -/// -/// 物体材质 -/// -public class ActivityMaterial -{ - /// - /// 摩擦力 - /// - public float Friction { get; set; } = 140; - - /// - /// 旋转摩擦力 - /// - public float RotationFriction { get; set; } = 140; - - /// - /// 落地之后是否回弹 - /// - public bool Bounce { get; set; } = true; - - /// - /// 物体回弹的强度 - /// - public float BounceStrength { get; set; } = 0.5f; - - /// - /// 物体下坠回弹后的运动速度衰减量 - /// - public float FallBounceSpeed { get; set; } = 0.75f; - - /// - /// 物体下坠回弹后的旋转速度衰减量 - /// - public float FallBounceRotation { get; set; } = 0.5f; -} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/framework/activity/ActivityObject.cs b/DungeonShooting_Godot/src/framework/activity/ActivityObject.cs index 77ceeba..9faa5fe 100644 --- a/DungeonShooting_Godot/src/framework/activity/ActivityObject.cs +++ b/DungeonShooting_Godot/src/framework/activity/ActivityObject.cs @@ -25,8 +25,17 @@ /// /// 是否是静态物体, 如果为true, 则会禁用移动处理 /// - [Export] - public bool IsStatic { get; set; } + public bool IsStatic + { + get => MoveController != null ? !MoveController.Enable : true; + set + { + if (MoveController != null) + { + MoveController.Enable = !value; + } + } + } /// /// 是否显示阴影 @@ -156,6 +165,11 @@ public bool EnableVerticalMotion { get; set; } = true; /// + /// 撞到墙壁反弹时是否锁定旋转角度, 如果为 false, 则反弹后将直接修改旋转角度 + /// + public bool BounceLockRotation { get; set; } = true; + + /// /// 是否启用物体更新行为, 默认 true, 如果禁用, 则会停止当前物体的 Process(), PhysicsProcess() 调用, 并且禁用 Collision 节点, 禁用后所有组件也同样被禁用行为 /// public bool EnableBehavior @@ -189,7 +203,7 @@ /// /// 物体材质数据 /// - public ActivityMaterial ActivityMaterial { get; private set; } + public ExcelConfig.ActivityMaterial ActivityMaterial { get; private set; } /// /// 所在的 World 对象 @@ -252,7 +266,7 @@ // -------------------------------------------------------------------------------- //组件集合 - private List> _components = new List>(); + private readonly List> _components = new List>(); //上一帧动画名称 private string _prevAnimation; //上一帧动画 @@ -267,7 +281,7 @@ private ShaderMaterial _shadowBlendShaderMaterial; //存储投抛该物体时所产生的数据 - private ActivityFallData _fallData = new ActivityFallData(); + private readonly ActivityFallData _fallData = new ActivityFallData(); //所在层级 private RoomLayerEnum _currLayer; @@ -330,7 +344,15 @@ } } #endif - ActivityMaterial = new ActivityMaterial(); + if (config.Material == null) + { + ActivityMaterial = ExcelConfig.ActivityMaterial_List[0]; + } + else + { + ActivityMaterial = config.Material; + } + World = world; ItemConfig = config; Name = GetType().Name + (_instanceIndex++); @@ -349,7 +371,7 @@ ShadowSprite.Visible = false; MotionMode = MotionModeEnum.Floating; MoveController = AddComponent(); - MoveController.Enable = !IsStatic; + IsStatic = config.IsStatic; OnInit(); } @@ -594,6 +616,13 @@ } /// + /// 撞到墙壁反弹时调用该函数, 参数为反弹的角度, 弧度制 + /// + public virtual void OnBounce(float rotation) + { + } + + /// /// 返回当物体 CollisionLayer 是否能与 mask 层碰撞 /// public bool CollisionWithMask(uint mask) @@ -891,6 +920,52 @@ } } + // 更新下坠处理逻辑 + UpdateFall(newDelta); + + //阴影 + UpdateShadowSprite(newDelta); + + // Hit 动画 + if (_playHit) + { + if (_playHitSchedule < 0.05f) + { + _blendShaderMaterial.SetShaderParameter("schedule", 1); + } + else if (_playHitSchedule < 0.15f) + { + _blendShaderMaterial.SetShaderParameter("schedule", Mathf.Lerp(1, 0, (_playHitSchedule - 0.05f) / 0.1f)); + } + if (_playHitSchedule >= 0.15f) + { + _blendShaderMaterial.SetShaderParameter("schedule", 0); + _playHitSchedule = 0; + _playHit = false; + } + else + { + _playHitSchedule += newDelta; + } + } + + //协程更新 + ProxyCoroutineHandler.ProxyUpdateCoroutine(ref _coroutineList, newDelta); + + ProcessOver(newDelta); + + //调试绘制 + if (IsDebug) + { + QueueRedraw(); + } + } + + /// + /// 更新下坠处理逻辑 + /// + public void UpdateFall(float delta) + { // 下坠判定 if (Altitude > 0 || VerticalSpeed != 0) { @@ -906,8 +981,8 @@ var ysp = VerticalSpeed; - _altitude += VerticalSpeed * newDelta; - _verticalSpeed -= GameConfig.G * newDelta; + _altitude += VerticalSpeed * delta; + _verticalSpeed -= GameConfig.G * delta; //当高度大于16时, 显示在所有物体上 if (Altitude >= 16) @@ -952,17 +1027,17 @@ if (!_hasResilienceVerticalSpeed) { _hasResilienceVerticalSpeed = true; - _resilienceVerticalSpeed = -VerticalSpeed * ActivityMaterial.BounceStrength; + _resilienceVerticalSpeed = -VerticalSpeed * ActivityMaterial.FallBounceStrength; } else { if (_resilienceVerticalSpeed < 25) { - _resilienceVerticalSpeed = _resilienceVerticalSpeed * ActivityMaterial.BounceStrength * 0.4f; + _resilienceVerticalSpeed = _resilienceVerticalSpeed * ActivityMaterial.FallBounceStrength * 0.4f; } else { - _resilienceVerticalSpeed = _resilienceVerticalSpeed * ActivityMaterial.BounceStrength; + _resilienceVerticalSpeed = _resilienceVerticalSpeed * ActivityMaterial.FallBounceStrength; } } _verticalSpeed = _resilienceVerticalSpeed; @@ -992,7 +1067,14 @@ } } - //阴影 + } + + /// + /// 更新阴影逻辑 + /// + public void UpdateShadowSprite(float delta) + { + // 阴影 if (ShadowSprite.Visible) { //更新阴影贴图, 使其和动画一致 @@ -1014,41 +1096,8 @@ } } - // Hit 动画 - if (_playHit) - { - if (_playHitSchedule < 0.05f) - { - _blendShaderMaterial.SetShaderParameter("schedule", 1); - } - else if (_playHitSchedule < 0.15f) - { - _blendShaderMaterial.SetShaderParameter("schedule", Mathf.Lerp(1, 0, (_playHitSchedule - 0.05f) / 0.1f)); - } - if (_playHitSchedule >= 0.15f) - { - _blendShaderMaterial.SetShaderParameter("schedule", 0); - _playHitSchedule = 0; - _playHit = false; - } - else - { - _playHitSchedule += newDelta; - } - } - - //协程更新 - ProxyCoroutineHandler.ProxyUpdateCoroutine(ref _coroutineList, newDelta); - - ProcessOver(newDelta); - - //调试绘制 - if (IsDebug) - { - QueueRedraw(); - } } - + /// /// 每物理帧调用一次, 为了防止子类覆盖 _PhysicsProcess(), 给 _PhysicsProcess() 加上了 sealed, 子类需要帧循环函数请重写 PhysicsProcess() 函数 /// @@ -1182,6 +1231,8 @@ { arr[i].Value?.Destroy(); } + + _components.Clear(); } /// diff --git a/DungeonShooting_Godot/src/framework/activity/ActivityObject_Init.cs b/DungeonShooting_Godot/src/framework/activity/ActivityObject_Init.cs index 9a8b289..79cdb91 100644 --- a/DungeonShooting_Godot/src/framework/activity/ActivityObject_Init.cs +++ b/DungeonShooting_Godot/src/framework/activity/ActivityObject_Init.cs @@ -79,7 +79,7 @@ /// public const string Id_bullet0003 = "bullet0003"; /// - /// 名称:
+ /// 名称: 榴弹炮
/// 简介: ///
public const string Id_bullet0004 = "bullet0004"; diff --git a/DungeonShooting_Godot/src/framework/activity/components/MoveController.cs b/DungeonShooting_Godot/src/framework/activity/components/MoveController.cs index 4d1ffae..54ae315 100644 --- a/DungeonShooting_Godot/src/framework/activity/components/MoveController.cs +++ b/DungeonShooting_Godot/src/framework/activity/components/MoveController.cs @@ -30,6 +30,7 @@ } private Vector2 _basisVelocity = Vector2.Zero; + private float _flag = 0; /// /// 是否是静止状态 @@ -319,10 +320,10 @@ //处理旋转 if (rotationSpeed != 0) { - Master.Rotation += rotationSpeed * delta; + Rotation += rotationSpeed * delta; } - var friction = !Master.IsThrowing ? Master.GetCurrentFriction() : 0; - var rotationFriction = !Master.IsThrowing ? Mathf.DegToRad(Master.GetCurrentRotationFriction()) : 0; + var friction = !Master.IsThrowing && Master.Altitude <= 0 ? Master.GetCurrentFriction() : 0; + var rotationFriction = !Master.IsThrowing && Master.Altitude <= 0 ? Mathf.DegToRad(Master.GetCurrentRotationFriction()) : 0; //衰减旋转速率 for (var i = 0; i < _forceList.Count; i++) { @@ -346,6 +347,11 @@ //新速度 var newVelocity = Master.Velocity; + if (!Master.BounceLockRotation) //跟着反弹角度 + { + Rotation = newVelocity.Angle(); + } + if (newVelocity.X == 0f && _basisVelocity.X * finallyVelocity.X > 0) { _basisVelocity.X = 0; @@ -357,17 +363,28 @@ } //是否撞到物体 - var collision = Master.GetLastSlideCollision(); - if (collision != null) //执行反弹操作 + KinematicCollision2D collision; + _flag -= delta; + if (_flag <= 0 && (collision = Master.GetLastSlideCollision()) != null) //执行反弹操作 { + _flag = 0.1f; var no = collision.GetNormal().Rotated(Mathf.Pi * 0.5f); - newVelocity = (finallyVelocity - _basisVelocity).Reflect(no); + newVelocity = finallyEf.Reflect(no); + var rotation = newVelocity.Angle(); + + if (!Master.BounceLockRotation) //跟着反弹角度 + { + Rotation = rotation; + } + var length = _forceList.Count; var v = newVelocity / (length / Master.ActivityMaterial.BounceStrength); for (var i = 0; i < _forceList.Count; i++) { _forceList[i].Velocity = v; } + //调用反弹函数 + Master.OnBounce(rotation); } else //没有撞到物体 { diff --git a/DungeonShooting_Godot/src/game/GameApplication.cs b/DungeonShooting_Godot/src/game/GameApplication.cs index da85dc2..976ffb4 100644 --- a/DungeonShooting_Godot/src/game/GameApplication.cs +++ b/DungeonShooting_Godot/src/game/GameApplication.cs @@ -112,6 +112,7 @@ //固定帧率 //Engine.MaxFps = TargetFps; //调试绘制开关 + //IsDebug = true; ActivityObject.IsDebug = IsDebug; //Engine.TimeScale = 0.2f; //调整窗口分辨率 @@ -119,7 +120,7 @@ RefreshSubViewportSize(); //窗体大小改变 GetWindow().SizeChanged += OnWindowSizeChanged; - + ImageCanvas.Init(GetTree().CurrentScene); //初始化ui diff --git a/DungeonShooting_Godot/src/game/activity/bullet/explode/Explode.cs b/DungeonShooting_Godot/src/game/activity/bullet/explode/Explode.cs index 5108ee2..4b64dd8 100644 --- a/DungeonShooting_Godot/src/game/activity/bullet/explode/Explode.cs +++ b/DungeonShooting_Godot/src/game/activity/bullet/explode/Explode.cs @@ -31,7 +31,6 @@ private bool _init = false; - private AffiliationArea _affiliationArea; private float _hitRadius; private int _minHarm; private int _maxHarm; @@ -70,8 +69,7 @@ AnimationPlayer.AnimationFinished += OnAnimationFinish; BodyEntered += OnBodyEntered; } - - _affiliationArea = affiliationArea; + AttackLayer = attackLayer; _hitRadius = hitRadius; _minHarm = minHarm; @@ -81,7 +79,11 @@ CollisionMask = attackLayer | PhysicsLayer.Prop | PhysicsLayer.Throwing | PhysicsLayer.Debris; CircleShape.Radius = Mathf.Max(hitRadius, maxRepelled); - Check(); + //冲击波 + if (affiliationArea != null) + { + ShockWave(affiliationArea); + } } public void RunPlay() @@ -90,10 +92,11 @@ AnimationPlayer.Play(AnimatorNames.Play); } - public void Check() + //爆炸冲击波 + private void ShockWave(AffiliationArea affiliationArea) { var position = Position; - var freezeSprites = _affiliationArea.RoomInfo.StaticSprite.CollisionCircle(position, _repelledRadius, true); + var freezeSprites = affiliationArea.RoomInfo.StaticSprite.CollisionCircle(position, _repelledRadius, true); foreach (var freezeSprite in freezeSprites) { var temp = freezeSprite.Position - position; @@ -127,21 +130,30 @@ var temp = o.Position - Position; var len = temp.Length(); var angle = temp.Angle(); + + if (len <= _hitRadius) //在伤害半径内 + { + if (o is Role role) //是角色 + { + role.CallDeferred(nameof(role.Hurt), Utils.Random.RandomRangeInt(_minHarm, _maxHarm), angle); + } + else if (o is Bullet bullet) //是子弹 + { + if (bullet is BoomBullet boomBullet) //如果是爆炸子弹, 则直接销毁 + { + boomBullet.PlayBoom(); + } + bullet.Destroy(); + return; + } + } if (len <= _repelledRadius) //击退半径内 { var repelled = (_repelledRadius - len) / _repelledRadius * _maxRepelled; - o.MoveController.SetAllVelocity(Vector2.Zero); + //o.MoveController.SetAllVelocity(Vector2.Zero); o.MoveController.AddForce(Vector2.FromAngle(angle) * repelled); } - - if (o is Role role) - { - if (len <= _hitRadius) //在伤害半径内 - { - role.CallDeferred(nameof(role.Hurt), Utils.Random.RandomRangeInt(_minHarm, _maxHarm), angle); - } - } } } } \ No newline at end of file diff --git a/DungeonShooting_Godot/src/game/activity/bullet/normal/BoomBullet.cs b/DungeonShooting_Godot/src/game/activity/bullet/normal/BoomBullet.cs new file mode 100644 index 0000000..0420c53 --- /dev/null +++ b/DungeonShooting_Godot/src/game/activity/bullet/normal/BoomBullet.cs @@ -0,0 +1,48 @@ + +using Godot; + +/// +/// 爆炸子弹 +/// +[Tool] +public partial class BoomBullet : Bullet +{ + public override void OnLimeOver() + { + PlayBoom(); + Destroy(); + } + + public override void OnMaxDistance() + { + PlayBoom(); + Destroy(); + } + + public override void OnCollisionTarget(ActivityObject o) + { + PlayBoom(); + Destroy(); + } + + public override void OnCollisionWall(KinematicCollision2D lastSlideCollision) + { + if (CurrentBounce > BulletData.BounceCount) //反弹次数超过限制 + { + PlayBoom(); + } + } + + /// + /// 播放爆炸 + /// + public void PlayBoom() + { + var explode = ObjectManager.GetExplode(ResourcePath.prefab_bullet_explode_Explode0001_tscn); + explode.Position = Position; + explode.RotationDegrees = Utils.Random.RandomRangeInt(0, 360); + explode.AddToActivityRootDeferred(RoomLayerEnum.YSortLayer); + explode.Init(BulletData.TriggerRole?.AffiliationArea, AttackLayer, 25, BulletData.MinHarm, BulletData.MaxHarm, 50, 150); + explode.RunPlay(); + } +} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/game/activity/bullet/normal/Bullet.cs b/DungeonShooting_Godot/src/game/activity/bullet/normal/Bullet.cs index 234e7fe..1e2dc5c 100644 --- a/DungeonShooting_Godot/src/game/activity/bullet/normal/Bullet.cs +++ b/DungeonShooting_Godot/src/game/activity/bullet/normal/Bullet.cs @@ -1,5 +1,4 @@ using System.Collections; -using Config; using Godot; /// @@ -24,24 +23,51 @@ } public BulletData BulletData { get; private set; } - - + + /// + /// 当前反弹次数 + /// + public int CurrentBounce { get; set; } = 0; + //当前子弹已经飞行的距离 private float CurrFlyDistance = 0; - + //上一次碰撞物体 + //private Rid _prevCollObject; + private float _flag = 0; + public override void OnInit() { + BounceLockRotation = false; CollisionArea.AreaEntered += OnArea2dEntered; } - public void InitData(BulletData data, uint attackLayer) + public virtual void InitData(BulletData data, uint attackLayer) { BulletData = data; AttackLayer = attackLayer; - Position = data.Position; Rotation = data.Rotation; - ShadowOffset = new Vector2(0, 5); - BasisVelocity = new Vector2(data.FlySpeed, 0).Rotated(Rotation); + + float altitude; + var triggerRole = data.TriggerRole; + if (triggerRole != null) + { + altitude = -triggerRole.MountPoint.Position.Y; + } + else + { + altitude = 8; + } + + Position = data.Position + new Vector2(0, altitude); + Altitude = altitude; + if (data.VerticalSpeed != 0) + { + VerticalSpeed = data.VerticalSpeed; + } + EnableVerticalMotion = data.BulletBase.UseGravity; + + //BasisVelocity = new Vector2(data.FlySpeed, 0).Rotated(Rotation); + MoveController.AddForce(new Vector2(data.FlySpeed, 0).Rotated(Rotation)); //如果子弹会对玩家造成伤害, 则显示红色描边 if (Player.Current.CollisionWithMask(attackLayer)) @@ -51,6 +77,85 @@ PutDown(RoomLayerEnum.YSortLayer); //播放子弹移动动画 PlaySpriteAnimation(AnimatorNames.Move); + //强制更新下坠逻辑处理 + UpdateFall((float)GetProcessDeltaTime()); + + //过期销毁 + if (data.LifeTime > 0) + { + this.CallDelay(data.LifeTime, OnLimeOver); + } + } + + + /// + /// 碰到墙壁 + /// + public virtual void OnCollisionWall(KinematicCollision2D lastSlideCollision) + { + if (CurrentBounce > BulletData.BounceCount) //反弹次数超过限制 + { + //创建粒子特效 + var packedScene = ResourceManager.Load(ResourcePath.prefab_effect_weapon_BulletSmoke_tscn); + var smoke = packedScene.Instantiate(); + var rotated = AnimatedSprite.Position.Rotated(Rotation); + smoke.GlobalPosition = lastSlideCollision.GetPosition() + new Vector2(0, rotated.Y); + smoke.GlobalRotation = lastSlideCollision.GetNormal().Angle(); + smoke.AddToActivityRoot(RoomLayerEnum.YSortLayer); + Destroy(); + } + } + + /// + /// 碰到目标 + /// + public virtual void OnCollisionTarget(ActivityObject o) + { + if (o is Role role) + { + PlayDisappearEffect(); + + //计算子弹造成的伤害 + var damage = Utils.Random.RandomRangeInt(BulletData.MinHarm, BulletData.MaxHarm); + if (BulletData.TriggerRole != null) + { + damage = BulletData.TriggerRole.RoleState.CallCalcDamageEvent(damage); + } + + //击退 + if (role is not Player) //目标不是玩家才会触发击退 + { + var attr = BulletData.Weapon.GetUseAttribute(BulletData.TriggerRole); + var repel = Utils.Random.RandomConfigRange(attr.Bullet.RepelRnage); + if (repel != 0) + { + //role.MoveController.AddForce(Vector2.FromAngle(BasisVelocity.Angle()) * repel); + role.MoveController.AddForce(Vector2.FromAngle(Velocity.Angle()) * repel); + } + } + + //造成伤害 + role.CallDeferred(nameof(Role.Hurt), damage, Rotation); + Destroy(); + } + } + + /// + /// 到达最大运行距离 + /// + public virtual void OnMaxDistance() + { + PlayDisappearEffect(); + Destroy(); + } + + /// + /// 子弹生命周期结束 + /// + public virtual void OnLimeOver() + { + PlayDisappearEffect(); + Destroy(); } /// @@ -79,85 +184,41 @@ { var packedScene = ResourceManager.Load(ResourcePath.prefab_effect_weapon_BulletDisappear_tscn); var node = packedScene.Instantiate(); - node.GlobalPosition = GlobalPosition; + node.GlobalPosition = AnimatedSprite.GlobalPosition; node.AddToActivityRoot(RoomLayerEnum.YSortLayer); } - protected override void PhysicsProcessOver(float delta) + protected override void PhysicsProcess(float delta) { //移动 - var lastSlideCollision = GetLastSlideCollision(); + KinematicCollision2D lastSlideCollision; //撞到墙 - if (lastSlideCollision != null) + _flag -= delta; + if (_flag <= 0 && (lastSlideCollision = GetLastSlideCollision()) != null) { - //创建粒子特效 - var packedScene = ResourceManager.Load(ResourcePath.prefab_effect_weapon_BulletSmoke_tscn); - var smoke = packedScene.Instantiate(); - smoke.GlobalPosition = lastSlideCollision.GetPosition(); - smoke.GlobalRotation = lastSlideCollision.GetNormal().Angle(); - smoke.AddToActivityRoot(RoomLayerEnum.YSortLayer); - Destroy(); - return; + _flag = 0.1f; + CurrentBounce++; + //撞墙 + OnCollisionWall(lastSlideCollision); } - //距离太大, 自动销毁 - CurrFlyDistance += BulletData.FlySpeed * delta; - if (CurrFlyDistance >= BulletData.MaxDistance) + else { - PlayDisappearEffect(); - Destroy(); + //距离太大, 自动销毁 + CurrFlyDistance += BulletData.FlySpeed * delta; + if (CurrFlyDistance >= BulletData.MaxDistance) + { + OnMaxDistance(); + } } } private void OnArea2dEntered(Area2D other) { - var role = other.AsActivityObject(); - if (role != null) + if (IsDestroyed) { - var packedScene = ResourceManager.Load(ResourcePath.prefab_effect_weapon_BulletDisappear_tscn); - var node = packedScene.Instantiate(); - node.GlobalPosition = GlobalPosition; - node.AddToActivityRoot(RoomLayerEnum.YSortLayer); - - //计算子弹造成的伤害 - var damage = Utils.Random.RandomRangeInt(BulletData.MinHarm, BulletData.MaxHarm); - if (BulletData.TriggerRole != null) - { - damage = BulletData.TriggerRole.RoleState.CallCalcDamageEvent(damage); - } - - //击退 - if (role is not Player) //目标不是玩家才会触发击退 - { - var attr = BulletData.Weapon.GetUseAttribute(BulletData.TriggerRole); - var repel = Utils.Random.RandomConfigRange(attr.Bullet.RepelRnage); - if (repel != 0) - { - role.MoveController.AddForce(Vector2.FromAngle(BasisVelocity.Angle()) * repel); - } - } - - //造成伤害 - role.CallDeferred(nameof(Role.Hurt), damage, Rotation); - Destroy(); + return; } - } - - protected override void OnDestroy() - { - StopAllCoroutine(); - } - - private void TestBoom() - { - //击中爆炸,测试用 - if (BulletData.TriggerRole == null || !BulletData.TriggerRole.IsAi) - { - var explode = ObjectManager.GetExplode(ResourcePath.prefab_bullet_explode_Explode0001_tscn); - explode.Position = Position; - explode.RotationDegrees = Utils.Random.RandomRangeInt(0, 360); - explode.AddToActivityRootDeferred(RoomLayerEnum.YSortLayer); - explode.Init(BulletData.TriggerRole.AffiliationArea, AttackLayer, 25, BulletData.MinHarm, BulletData.MaxHarm, 50, 150); - explode.RunPlay(); - } + var activityObject = other.AsActivityObject(); + OnCollisionTarget(activityObject); } } \ 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 9f77443..379448d 100644 --- a/DungeonShooting_Godot/src/game/activity/shell/Shell.cs +++ b/DungeonShooting_Godot/src/game/activity/shell/Shell.cs @@ -16,7 +16,7 @@ protected override void Process(float delta) { //落地静止后将弹壳变为静态贴图 - if (!IsThrowing && MoveController.IsMotionless()) + if (!IsThrowing && Altitude <= 0 && MoveController.IsMotionless()) { if (AffiliationArea != null) { diff --git a/DungeonShooting_Godot/src/game/activity/weapon/Weapon.cs b/DungeonShooting_Godot/src/game/activity/weapon/Weapon.cs index 8edeeb8..bcd9306 100644 --- a/DungeonShooting_Godot/src/game/activity/weapon/Weapon.cs +++ b/DungeonShooting_Godot/src/game/activity/weapon/Weapon.cs @@ -1953,6 +1953,8 @@ MaxHarm = Utils.GetConfigRangeEnd(bullet.HarmRange), MaxDistance = Utils.Random.RandomConfigRange(bullet.DistanceRange), FlySpeed = Utils.Random.RandomConfigRange(bullet.SpeedRange), + VerticalSpeed = Utils.Random.RandomConfigRange(bullet.VerticalSpeed), + BounceCount = Utils.Random.RandomConfigRange(bullet.BounceCount), Position = FirePoint.GlobalPosition, }; @@ -1989,6 +1991,8 @@ MinHarm = Utils.GetConfigRangeStart(bullet.HarmRange), MaxHarm = Utils.GetConfigRangeEnd(bullet.HarmRange), MaxDistance = Utils.Random.RandomConfigRange(bullet.DistanceRange), + BounceCount = Utils.Random.RandomConfigRange(bullet.BounceCount), + LifeTime = Utils.Random.RandomConfigRange(bullet.LifeTimeRange), Position = FirePoint.GlobalPosition, }; diff --git a/DungeonShooting_Godot/src/game/data/BulletData.cs b/DungeonShooting_Godot/src/game/data/BulletData.cs index d7146cd..e15913f 100644 --- a/DungeonShooting_Godot/src/game/data/BulletData.cs +++ b/DungeonShooting_Godot/src/game/data/BulletData.cs @@ -43,6 +43,21 @@ public float FlySpeed; /// + /// 纵轴速度 + /// + public float VerticalSpeed; + + /// + /// 反弹次数 + /// + public int BounceCount; + + /// + /// 子弹最大存在时间 + /// + public float LifeTime; + + /// /// 坐标 /// public Vector2 Position; diff --git a/DungeonShooting_Godot/src/game/effects/EnemyDebris.cs b/DungeonShooting_Godot/src/game/effects/EnemyDebris.cs index e0c08bb..d96d1c2 100644 --- a/DungeonShooting_Godot/src/game/effects/EnemyDebris.cs +++ b/DungeonShooting_Godot/src/game/effects/EnemyDebris.cs @@ -29,7 +29,7 @@ protected override void Process(float delta) { - if (_playOver && !IsThrowing && MoveController.IsMotionless()) + if (_playOver && !IsThrowing && Altitude <= 0 && MoveController.IsMotionless()) { MoveController.SetAllVelocity(Vector2.Zero); Freeze();