diff --git a/DungeonShooting_Godot/excel/excelFile/ActivityBase.xlsx b/DungeonShooting_Godot/excel/excelFile/ActivityBase.xlsx
index 93b8a71..4decea8 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/AiAttackAttr.xlsx b/DungeonShooting_Godot/excel/excelFile/AiAttackAttr.xlsx
index 385ecc5..fb0eb59 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 2777096..24855bd 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 a1a82fc..1858468 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 c8f287d..e0141a0 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/Bullet0003.tscn b/DungeonShooting_Godot/prefab/bullet/normal/Bullet0003.tscn
index 9c2a1a5..18ea61f 100644
--- a/DungeonShooting_Godot/prefab/bullet/normal/Bullet0003.tscn
+++ b/DungeonShooting_Godot/prefab/bullet/normal/Bullet0003.tscn
@@ -4,7 +4,6 @@
[ext_resource type="Shader" path="res://resource/material/Blend.gdshader" id="2_bteri"]
[ext_resource type="SpriteFrames" uid="uid://bcnhyin0aufl1" path="res://resource/spriteFrames/bullet/Bullet0003.tres" id="3_qvo0u"]
-
[sub_resource type="ShaderMaterial" id="ShaderMaterial_v77gw"]
resource_local_to_scene = true
shader = ExtResource("2_bteri")
@@ -14,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_p0wfd"]
resource_local_to_scene = true
@@ -24,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_c0onq"]
size = Vector2(6, 3.125)
diff --git a/DungeonShooting_Godot/prefab/bullet/normal/Bullet0004.tscn b/DungeonShooting_Godot/prefab/bullet/normal/Bullet0004.tscn
new file mode 100644
index 0000000..c22dc44
--- /dev/null
+++ b/DungeonShooting_Godot/prefab/bullet/normal/Bullet0004.tscn
@@ -0,0 +1,60 @@
+[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="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"]
+
+[sub_resource type="ShaderMaterial" id="ShaderMaterial_v77gw"]
+resource_local_to_scene = true
+shader = ExtResource("2_w1qob")
+shader_parameter/blend = Color(0, 0, 0, 0.470588)
+shader_parameter/schedule = 1.0
+shader_parameter/modulate = Color(1, 1, 1, 1)
+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_p0wfd"]
+resource_local_to_scene = true
+shader = ExtResource("2_w1qob")
+shader_parameter/blend = Color(1, 1, 1, 1)
+shader_parameter/schedule = 0.0
+shader_parameter/modulate = Color(1, 1, 1, 1)
+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_c0onq"]
+size = Vector2(4, 4)
+
+[node name="Bullet0003" type="CharacterBody2D" node_paths=PackedStringArray("CollisionArea", "ShadowSprite", "AnimatedSprite", "Collision")]
+collision_layer = 2
+script = ExtResource("1_teoyi")
+CollisionArea = NodePath("CollisionArea")
+ShadowSprite = NodePath("ShadowSprite")
+AnimatedSprite = NodePath("AnimatedSprite")
+Collision = NodePath("Collision")
+
+[node name="ShadowSprite" type="Sprite2D" parent="."]
+z_index = -1
+material = SubResource("ShaderMaterial_v77gw")
+
+[node name="AnimatedSprite" type="AnimatedSprite2D" parent="."]
+material = SubResource("ShaderMaterial_p0wfd")
+sprite_frames = ExtResource("3_bttus")
+animation = &"move"
+frame_progress = 0.807435
+
+[node name="CollisionArea" type="Area2D" parent="."]
+collision_layer = 0
+collision_mask = 0
+monitorable = false
+
+[node name="CollisionShape2D" type="CollisionShape2D" parent="CollisionArea"]
+position = Vector2(1, 0)
+shape = SubResource("RectangleShape2D_c0onq")
+
+[node name="Collision" type="CollisionShape2D" parent="."]
+shape = SubResource("RectangleShape2D_c0onq")
diff --git a/DungeonShooting_Godot/resource/config/ActivityBase.json b/DungeonShooting_Godot/resource/config/ActivityBase.json
index eba092a..eaaebd3 100644
--- a/DungeonShooting_Godot/resource/config/ActivityBase.json
+++ b/DungeonShooting_Godot/resource/config/ActivityBase.json
@@ -5,6 +5,7 @@
"Name": "\u73A9\u5BB6",
"Intro": "\u73A9\u5BB6",
"Details": "",
+ "IsStatic": false,
"Prefab": "res://prefab/role/Role0001.tscn",
"Icon": "res://resource/sprite/role/role0001/Role0001_Icon.png",
"ShowInMapEditor": false
@@ -15,6 +16,7 @@
"Name": "\u654C\u4EBA",
"Intro": "\u654C\u4EBA",
"Details": "",
+ "IsStatic": false,
"Prefab": "res://prefab/role/Enemy0001.tscn",
"Icon": "res://resource/sprite/role/enemy0001/enemy0001_Icon.png",
"ShowInMapEditor": true
@@ -25,6 +27,7 @@
"Name": "\u6B65\u67AA",
"Intro": "",
"Details": "",
+ "IsStatic": false,
"Prefab": "res://prefab/weapon/Weapon0001.tscn",
"Icon": "res://resource/sprite/weapon/weapon0001/Weapon0001.png",
"ShowInMapEditor": true
@@ -35,6 +38,7 @@
"Name": "\u9730\u5F39\u67AA",
"Intro": "",
"Details": "",
+ "IsStatic": false,
"Prefab": "res://prefab/weapon/Weapon0002.tscn",
"Icon": "res://resource/sprite/weapon/weapon0002/Weapon0002.png",
"ShowInMapEditor": true
@@ -45,6 +49,7 @@
"Name": "\u624B\u67AA",
"Intro": "",
"Details": "",
+ "IsStatic": false,
"Prefab": "res://prefab/weapon/Weapon0003.tscn",
"Icon": "res://resource/sprite/weapon/weapon0003/Weapon0003.png",
"ShowInMapEditor": true
@@ -55,6 +60,7 @@
"Name": "\u5200",
"Intro": "",
"Details": "",
+ "IsStatic": false,
"Prefab": "res://prefab/weapon/Weapon0004.tscn",
"Icon": "res://resource/sprite/weapon/knife1.png",
"ShowInMapEditor": true
@@ -65,6 +71,7 @@
"Name": "\u72D9\u51FB\u67AA",
"Intro": "",
"Details": "",
+ "IsStatic": false,
"Prefab": "res://prefab/weapon/Weapon0005.tscn",
"Icon": "res://resource/sprite/weapon/weapon0005/Weapon0005.png",
"ShowInMapEditor": true
@@ -75,6 +82,7 @@
"Name": "\u51B2\u950B\u67AA",
"Intro": "",
"Details": "",
+ "IsStatic": false,
"Prefab": "res://prefab/weapon/Weapon0006.tscn",
"Icon": "res://resource/sprite/weapon/weapon0006/Weapon0006.png",
"ShowInMapEditor": true
@@ -85,6 +93,7 @@
"Name": "\u6C64\u59C6\u900A\u51B2\u950B\u67AA",
"Intro": "",
"Details": "",
+ "IsStatic": false,
"Prefab": "res://prefab/weapon/Weapon0007.tscn",
"Icon": "res://resource/sprite/weapon/weapon0007/Weapon0007.png",
"ShowInMapEditor": true
@@ -95,6 +104,7 @@
"Name": "\u6FC0\u5149\u624B\u67AA",
"Intro": "",
"Details": "",
+ "IsStatic": false,
"Prefab": "res://prefab/weapon/Weapon0008.tscn",
"Icon": "res://resource/sprite/weapon/weapon0008/Weapon0008.png",
"ShowInMapEditor": true
@@ -105,6 +115,7 @@
"Name": "\u69B4\u5F39\u53D1\u5C04\u5668",
"Intro": "",
"Details": "",
+ "IsStatic": false,
"Prefab": "res://prefab/weapon/Weapon0009.tscn",
"Icon": "res://resource/sprite/weapon/weapon0009/Weapon0009.png",
"ShowInMapEditor": true
@@ -115,6 +126,7 @@
"Name": "",
"Intro": "",
"Details": "",
+ "IsStatic": false,
"Prefab": "res://prefab/bullet/normal/Bullet0001.tscn",
"Icon": "",
"ShowInMapEditor": false
@@ -125,6 +137,7 @@
"Name": "",
"Intro": "",
"Details": "",
+ "IsStatic": false,
"Prefab": "res://prefab/bullet/normal/Bullet0002.tscn",
"Icon": "",
"ShowInMapEditor": false
@@ -135,16 +148,29 @@
"Name": "",
"Intro": "",
"Details": "",
+ "IsStatic": false,
"Prefab": "res://prefab/bullet/normal/Bullet0003.tscn",
"Icon": "",
"ShowInMapEditor": false
},
{
+ "Id": "bullet0004",
+ "Type": 6,
+ "Name": "",
+ "Intro": "",
+ "Details": "",
+ "IsStatic": false,
+ "Prefab": "res://prefab/bullet/normal/Bullet0004.tscn",
+ "Icon": "",
+ "ShowInMapEditor": false
+ },
+ {
"Id": "shell0001",
"Type": 7,
"Name": "",
"Intro": "",
"Details": "",
+ "IsStatic": false,
"Prefab": "res://prefab/shell/Shell0001.tscn",
"Icon": "",
"ShowInMapEditor": false
@@ -155,6 +181,7 @@
"Name": "",
"Intro": "",
"Details": "",
+ "IsStatic": false,
"Prefab": "res://prefab/shell/Shell0002.tscn",
"Icon": "",
"ShowInMapEditor": false
@@ -165,6 +192,7 @@
"Name": "",
"Intro": "",
"Details": "",
+ "IsStatic": false,
"Prefab": "res://prefab/shell/Shell0003.tscn",
"Icon": "",
"ShowInMapEditor": false
@@ -175,6 +203,7 @@
"Name": "",
"Intro": "\u654C\u4EBA\u6B7B\u4EA1\u788E\u7247",
"Details": "",
+ "IsStatic": false,
"Prefab": "res://prefab/effect/enemy/Effect0001.tscn",
"Icon": "",
"ShowInMapEditor": false
@@ -185,6 +214,7 @@
"Name": "\u978B\u5B50",
"Intro": "\u63D0\u9AD8\u79FB\u52A8\u901F\u5EA6",
"Details": "",
+ "IsStatic": false,
"Prefab": "res://prefab/effect/enemy/Effect0001.tscn",
"Icon": "res://resource/sprite/prop/buff/BuffProp0001.png",
"ShowInMapEditor": true
@@ -195,6 +225,7 @@
"Name": "\u5FC3\u4E4B\u5BB9\u5668",
"Intro": "\u63D0\u9AD8\u8840\u91CF\u4E0A\u9650",
"Details": "",
+ "IsStatic": false,
"Prefab": "res://prefab/prop/buff/BuffProp0002.tscn",
"Icon": "res://resource/sprite/prop/buff/BuffProp0002.png",
"ShowInMapEditor": true
@@ -205,6 +236,7 @@
"Name": "\u62A4\u76FE",
"Intro": "\u53EF\u4EE5\u62B5\u6321\u5B50\u5F39\uFF0C\u968F\u65F6\u95F4\u63A8\u79FB\u81EA\u52A8\u6062\u590D",
"Details": "",
+ "IsStatic": false,
"Prefab": "res://prefab/prop/buff/BuffProp0003.tscn",
"Icon": "res://resource/sprite/prop/buff/BuffProp0003.png",
"ShowInMapEditor": true
@@ -215,6 +247,7 @@
"Name": "\u62A4\u76FE\u8BA1\u65F6\u5668",
"Intro": "\u63D0\u9AD8\u62A4\u76FE\u6062\u590D\u901F\u5EA6",
"Details": "",
+ "IsStatic": false,
"Prefab": "res://prefab/prop/buff/BuffProp0004.tscn",
"Icon": "res://resource/sprite/prop/buff/BuffProp0004.png",
"ShowInMapEditor": true
@@ -225,6 +258,7 @@
"Name": "\u6740\u4F24\u5F39",
"Intro": "\u63D0\u9AD8\u5B50\u5F39\u4F24\u5BB3",
"Details": "",
+ "IsStatic": false,
"Prefab": "res://prefab/prop/buff/BuffProp0005.tscn",
"Icon": "res://resource/sprite/prop/buff/BuffProp0005.png",
"ShowInMapEditor": true
@@ -235,6 +269,7 @@
"Name": "\u7EA2\u5B9D\u77F3\u6212\u6307",
"Intro": "\u53D7\u4F24\u540E\u5EF6\u957F\u65E0\u654C\u65F6\u95F4",
"Details": "",
+ "IsStatic": false,
"Prefab": "res://prefab/prop/buff/BuffProp0006.tscn",
"Icon": "res://resource/sprite/prop/buff/BuffProp0006.png",
"ShowInMapEditor": true
@@ -245,6 +280,7 @@
"Name": "\u5907\u7528\u62A4\u76FE",
"Intro": "\u53D7\u4F24\u65F6\u6709\u4E00\u5B9A\u6982\u7387\u62B5\u6D88\u4F24\u5BB3",
"Details": "",
+ "IsStatic": false,
"Prefab": "res://prefab/prop/buff/BuffProp0007.tscn",
"Icon": "res://resource/sprite/prop/buff/BuffProp0007.png",
"ShowInMapEditor": true
@@ -255,6 +291,7 @@
"Name": "\u773C\u955C",
"Intro": "\u63D0\u9AD8\u6B66\u5668\u7CBE\u51C6\u5EA6",
"Details": "",
+ "IsStatic": false,
"Prefab": "res://prefab/prop/buff/BuffProp0008.tscn",
"Icon": "res://resource/sprite/prop/buff/BuffProp0008.png",
"ShowInMapEditor": true
@@ -265,6 +302,7 @@
"Name": "\u9AD8\u901F\u5B50\u5F39",
"Intro": "\u63D0\u9AD8\u5B50\u5F39\u901F\u5EA6\u548C\u5C04\u7A0B",
"Details": "",
+ "IsStatic": false,
"Prefab": "res://prefab/prop/buff/BuffProp0009.tscn",
"Icon": "res://resource/sprite/prop/buff/BuffProp0009.png",
"ShowInMapEditor": true
@@ -275,6 +313,7 @@
"Name": "\u5206\u88C2\u5B50\u5F39",
"Intro": "\u5B50\u5F39\u6570\u91CF\u7FFB\u500D, \u4F46\u662F\u7CBE\u51C6\u5EA6\u548C\u4F24\u5BB3\u964D\u4F4E",
"Details": "",
+ "IsStatic": false,
"Prefab": "res://prefab/prop/buff/BuffProp0010.tscn",
"Icon": "res://resource/sprite/prop/buff/BuffProp0010.png",
"ShowInMapEditor": true
@@ -285,6 +324,7 @@
"Name": "\u533B\u836F\u7BB1",
"Intro": "\u4F7F\u7528\u540E\u56DE\u590D\u4E00\u9897\u7EA2\u5FC3",
"Details": "",
+ "IsStatic": false,
"Prefab": "res://prefab/prop/active/ActiveProp5000.tscn",
"Icon": "res://resource/sprite/prop/active/ActiveProp5000.png",
"ShowInMapEditor": true
@@ -295,6 +335,7 @@
"Name": "\u5F39\u836F\u7BB1",
"Intro": "\u4F7F\u7528\u540E\u8865\u5145\u5F53\u524D\u6B66\u5668\u5907\u7528\u5F39\u836F",
"Details": "",
+ "IsStatic": false,
"Prefab": "res://prefab/prop/active/ActiveProp5001.tscn",
"Icon": "res://resource/sprite/prop/active/ActiveProp5001.png",
"ShowInMapEditor": true
@@ -305,6 +346,7 @@
"Name": "",
"Intro": "\u5730\u7262\u623F\u95F4\u7684\u95E8(\u4E1C\u4FA7)",
"Details": "",
+ "IsStatic": false,
"Prefab": "res://prefab/map/RoomDoor_E.tscn",
"Icon": "",
"ShowInMapEditor": false
@@ -315,6 +357,7 @@
"Name": "",
"Intro": "\u5730\u7262\u623F\u95F4\u7684\u95E8(\u897F\u4FA7)",
"Details": "",
+ "IsStatic": true,
"Prefab": "res://prefab/map/RoomDoor_W.tscn",
"Icon": "",
"ShowInMapEditor": false
@@ -325,6 +368,7 @@
"Name": "",
"Intro": "\u5730\u7262\u623F\u95F4\u7684\u95E8(\u5357\u4FA7)",
"Details": "",
+ "IsStatic": true,
"Prefab": "res://prefab/map/RoomDoor_S.tscn",
"Icon": "",
"ShowInMapEditor": false
@@ -335,6 +379,7 @@
"Name": "",
"Intro": "\u5730\u7262\u623F\u95F4\u7684\u95E8(\u5317\u4FA7)",
"Details": "",
+ "IsStatic": true,
"Prefab": "res://prefab/map/RoomDoor_N.tscn",
"Icon": "",
"ShowInMapEditor": false
diff --git a/DungeonShooting_Godot/resource/config/BulletBase.json b/DungeonShooting_Godot/resource/config/BulletBase.json
index ce52c7f..d7d3c3c 100644
--- a/DungeonShooting_Godot/resource/config/BulletBase.json
+++ b/DungeonShooting_Godot/resource/config/BulletBase.json
@@ -3,24 +3,161 @@
"Id": "0001",
"Name": "\u5B50\u5F391",
"Type": 1,
- "Prefab": "bullet0001"
+ "Prefab": "bullet0001",
+ "HarmRange": [
+ 4
+ ],
+ "RepelRnage": [
+ 20
+ ],
+ "DeviationAngleRange": [
+ 0
+ ],
+ "SpeedRange": [
+ 320,
+ 350
+ ],
+ "LifeTimeRange": [
+ -1
+ ],
+ "DistanceRange": [
+ 300,
+ 400
+ ],
+ "UseGravity": false
},
{
"Id": "0002",
"Name": "\u5B50\u5F392",
"Type": 1,
- "Prefab": "bullet0002"
+ "Prefab": "bullet0002",
+ "HarmRange": [
+ 4
+ ],
+ "RepelRnage": [
+ 30
+ ],
+ "DeviationAngleRange": [
+ -10,
+ 10
+ ],
+ "SpeedRange": [
+ 280,
+ 380
+ ],
+ "LifeTimeRange": [
+ -1
+ ],
+ "DistanceRange": [
+ 200,
+ 250
+ ],
+ "UseGravity": false
},
{
"Id": "0003",
"Name": "\u5B50\u5F393",
"Type": 1,
- "Prefab": "bullet0003"
+ "Prefab": "bullet0003",
+ "HarmRange": [
+ 3
+ ],
+ "RepelRnage": [
+ 10
+ ],
+ "DeviationAngleRange": [
+ 0
+ ],
+ "SpeedRange": [
+ 320,
+ 340
+ ],
+ "LifeTimeRange": [
+ -1
+ ],
+ "DistanceRange": [
+ 300,
+ 400
+ ],
+ "UseGravity": false
+ },
+ {
+ "Id": "0004",
+ "Name": "\u69B4\u5F39\u70AE",
+ "Type": 1,
+ "Prefab": "bullet0004",
+ "HarmRange": [
+ 5
+ ],
+ "RepelRnage": [
+ 0
+ ],
+ "DeviationAngleRange": [
+ 0
+ ],
+ "SpeedRange": [
+ 30,
+ 30
+ ],
+ "LifeTimeRange": [
+ -1
+ ],
+ "DistanceRange": [
+ 270,
+ 360
+ ],
+ "UseGravity": false
},
{
"Id": "1001",
"Name": "\u6FC0\u51491",
"Type": 2,
- "Prefab": "res://prefab/bullet/laser/Laser0001.tscn"
+ "Prefab": "res://prefab/bullet/laser/Laser0001.tscn",
+ "HarmRange": [
+ 5
+ ],
+ "RepelRnage": [
+ 0
+ ],
+ "DeviationAngleRange": [
+ 0
+ ],
+ "SpeedRange": [
+ 300,
+ 330
+ ],
+ "LifeTimeRange": [
+ -1
+ ],
+ "DistanceRange": [
+ 270,
+ 360
+ ],
+ "UseGravity": false
+ },
+ {
+ "Id": "2001",
+ "Name": "\u5200\u4F24\u5BB3",
+ "Type": 3,
+ "Prefab": "",
+ "HarmRange": [
+ 25
+ ],
+ "RepelRnage": [
+ 150
+ ],
+ "DeviationAngleRange": [
+ 0
+ ],
+ "SpeedRange": [
+ 350
+ ],
+ "LifeTimeRange": [
+ -1
+ ],
+ "DistanceRange": [
+ 35
+ ],
+ "UseGravity": false
}
]
\ No newline at end of file
diff --git a/DungeonShooting_Godot/resource/config/WeaponBase.json b/DungeonShooting_Godot/resource/config/WeaponBase.json
index 13e9c1c..5082181 100644
--- a/DungeonShooting_Godot/resource/config/WeaponBase.json
+++ b/DungeonShooting_Godot/resource/config/WeaponBase.json
@@ -1,7 +1,7 @@
[
{
"Id": "0001",
- "ActivityId": "weapon0001",
+ "__Activity": "weapon0001",
"Remark": "\u6B65\u67AA",
"Weight": 40,
"WeightType": 2,
@@ -47,25 +47,8 @@
"DefaultAngle": 0,
"UpliftAngleRestore": 1,
"FireEffect": "res://prefab/effect/weapon/ShotFire.tscn",
- "BulletId": "0001",
- "HarmRange": [
- 4
- ],
- "RepelRnage": [
- 20
- ],
- "BulletDeviationAngleRange": [
- 0
- ],
- "BulletSpeedRange": [
- 320,
- 350
- ],
- "BulletDistanceRange": [
- 300,
- 400
- ],
- "ShellId": "shell0001",
+ "__Bullet": "0001",
+ "__Shell": "shell0001",
"ThrowShellDelayTime": 0,
"ThrowCollisionSize": {
"X": 20,
@@ -93,7 +76,7 @@
},
{
"Id": "0002",
- "ActivityId": "",
+ "__Activity": "",
"Remark": "\u6B65\u67AA",
"Weight": 40,
"WeightType": 2,
@@ -139,25 +122,8 @@
"DefaultAngle": 0,
"UpliftAngleRestore": 1,
"FireEffect": "res://prefab/effect/weapon/ShotFire.tscn",
- "BulletId": "0001",
- "HarmRange": [
- 4
- ],
- "RepelRnage": [
- 20
- ],
- "BulletDeviationAngleRange": [
- 0
- ],
- "BulletSpeedRange": [
- 320,
- 350
- ],
- "BulletDistanceRange": [
- 300,
- 400
- ],
- "ShellId": "shell0001",
+ "__Bullet": "0001",
+ "__Shell": "shell0001",
"ThrowShellDelayTime": 0,
"ThrowCollisionSize": {
"X": 20,
@@ -185,7 +151,7 @@
},
{
"Id": "0003",
- "ActivityId": "weapon0002",
+ "__Activity": "weapon0002",
"Remark": "\u9730\u5F39\u67AA",
"Weight": 40,
"WeightType": 2,
@@ -231,26 +197,8 @@
"DefaultAngle": 0,
"UpliftAngleRestore": 1,
"FireEffect": "res://prefab/effect/weapon/ShotFire.tscn",
- "BulletId": "0002",
- "HarmRange": [
- 4
- ],
- "RepelRnage": [
- 30
- ],
- "BulletDeviationAngleRange": [
- -10,
- 10
- ],
- "BulletSpeedRange": [
- 280,
- 380
- ],
- "BulletDistanceRange": [
- 200,
- 250
- ],
- "ShellId": "shell0002",
+ "__Bullet": "0002",
+ "__Shell": "shell0002",
"ThrowShellDelayTime": 0.2,
"ThrowCollisionSize": {
"X": 20,
@@ -278,7 +226,7 @@
},
{
"Id": "0004",
- "ActivityId": "",
+ "__Activity": "",
"Remark": "\u9730\u5F39\u67AA",
"Weight": 40,
"WeightType": 2,
@@ -324,26 +272,8 @@
"DefaultAngle": 0,
"UpliftAngleRestore": 1,
"FireEffect": "res://prefab/effect/weapon/ShotFire.tscn",
- "BulletId": "0002",
- "HarmRange": [
- 4
- ],
- "RepelRnage": [
- 30
- ],
- "BulletDeviationAngleRange": [
- -10,
- 10
- ],
- "BulletSpeedRange": [
- 280,
- 380
- ],
- "BulletDistanceRange": [
- 200,
- 250
- ],
- "ShellId": "shell0002",
+ "__Bullet": "0002",
+ "__Shell": "shell0002",
"ThrowShellDelayTime": 0.2,
"ThrowCollisionSize": {
"X": 20,
@@ -371,7 +301,7 @@
},
{
"Id": "0005",
- "ActivityId": "weapon0003",
+ "__Activity": "weapon0003",
"Remark": "\u624B\u67AA",
"Weight": 20,
"WeightType": 1,
@@ -417,25 +347,8 @@
"DefaultAngle": 0,
"UpliftAngleRestore": 1,
"FireEffect": "res://prefab/effect/weapon/ShotFire.tscn",
- "BulletId": "0001",
- "HarmRange": [
- 4
- ],
- "RepelRnage": [
- 20
- ],
- "BulletDeviationAngleRange": [
- 0
- ],
- "BulletSpeedRange": [
- 320,
- 350
- ],
- "BulletDistanceRange": [
- 250,
- 300
- ],
- "ShellId": "shell0001",
+ "__Bullet": "0001",
+ "__Shell": "shell0001",
"ThrowShellDelayTime": 0,
"ThrowCollisionSize": {
"X": 20,
@@ -463,7 +376,7 @@
},
{
"Id": "0006",
- "ActivityId": "",
+ "__Activity": "",
"Remark": "\u624B\u67AA",
"Weight": 20,
"WeightType": 1,
@@ -509,25 +422,8 @@
"DefaultAngle": 0,
"UpliftAngleRestore": 1,
"FireEffect": "res://prefab/effect/weapon/ShotFire.tscn",
- "BulletId": "0001",
- "HarmRange": [
- 4
- ],
- "RepelRnage": [
- 20
- ],
- "BulletDeviationAngleRange": [
- 0
- ],
- "BulletSpeedRange": [
- 320,
- 350
- ],
- "BulletDistanceRange": [
- 250,
- 300
- ],
- "ShellId": "shell0001",
+ "__Bullet": "0001",
+ "__Shell": "shell0001",
"ThrowShellDelayTime": 0,
"ThrowCollisionSize": {
"X": 20,
@@ -555,7 +451,7 @@
},
{
"Id": "0007",
- "ActivityId": "weapon0004",
+ "__Activity": "weapon0004",
"Remark": "\u5200",
"Weight": 40,
"WeightType": 2,
@@ -599,24 +495,9 @@
"UpliftAngle": -95,
"DefaultAngle": 0,
"UpliftAngleRestore": 1,
- "FireEffect": "res://prefab/effect/weapon/ShotFire.tscn",
- "BulletId": "0001",
- "HarmRange": [
- 25
- ],
- "RepelRnage": [
- 150
- ],
- "BulletDeviationAngleRange": [
- 0
- ],
- "BulletSpeedRange": [
- 350
- ],
- "BulletDistanceRange": [
- 35
- ],
- "ShellId": "",
+ "FireEffect": "",
+ "__Bullet": "2001",
+ "__Shell": "",
"ThrowShellDelayTime": 0,
"ThrowCollisionSize": {
"X": 20,
@@ -644,7 +525,7 @@
},
{
"Id": "0008",
- "ActivityId": "",
+ "__Activity": "",
"Remark": "\u5200",
"Weight": 40,
"WeightType": 2,
@@ -688,24 +569,9 @@
"UpliftAngle": -95,
"DefaultAngle": 0,
"UpliftAngleRestore": 1,
- "FireEffect": "res://prefab/effect/weapon/ShotFire.tscn",
- "BulletId": "0001",
- "HarmRange": [
- 25
- ],
- "RepelRnage": [
- 150
- ],
- "BulletDeviationAngleRange": [
- 0
- ],
- "BulletSpeedRange": [
- 350
- ],
- "BulletDistanceRange": [
- 35
- ],
- "ShellId": "",
+ "FireEffect": "",
+ "__Bullet": "2001",
+ "__Shell": "",
"ThrowShellDelayTime": 0,
"ThrowCollisionSize": {
"X": 20,
@@ -733,7 +599,7 @@
},
{
"Id": "0009",
- "ActivityId": "weapon0005",
+ "__Activity": "weapon0005",
"Remark": "\u72D9\u51FB\u67AA",
"Weight": 50,
"WeightType": 2,
@@ -779,25 +645,8 @@
"DefaultAngle": 0,
"UpliftAngleRestore": 1,
"FireEffect": "res://prefab/effect/weapon/ShotFire.tscn",
- "BulletId": "0001",
- "HarmRange": [
- 30
- ],
- "RepelRnage": [
- 250
- ],
- "BulletDeviationAngleRange": [
- 0
- ],
- "BulletSpeedRange": [
- 600,
- 620
- ],
- "BulletDistanceRange": [
- 700,
- 900
- ],
- "ShellId": "shell0003",
+ "__Bullet": "0001",
+ "__Shell": "shell0003",
"ThrowShellDelayTime": 0.2,
"ThrowCollisionSize": {
"X": 20,
@@ -825,7 +674,7 @@
},
{
"Id": "0010",
- "ActivityId": "",
+ "__Activity": "",
"Remark": "\u72D9\u51FB\u67AA",
"Weight": 50,
"WeightType": 2,
@@ -871,25 +720,8 @@
"DefaultAngle": 0,
"UpliftAngleRestore": 1,
"FireEffect": "res://prefab/effect/weapon/ShotFire.tscn",
- "BulletId": "0001",
- "HarmRange": [
- 30
- ],
- "RepelRnage": [
- 250
- ],
- "BulletDeviationAngleRange": [
- 0
- ],
- "BulletSpeedRange": [
- 600,
- 620
- ],
- "BulletDistanceRange": [
- 700,
- 900
- ],
- "ShellId": "shell0003",
+ "__Bullet": "0001",
+ "__Shell": "shell0003",
"ThrowShellDelayTime": 0.2,
"ThrowCollisionSize": {
"X": 20,
@@ -917,7 +749,7 @@
},
{
"Id": "0011",
- "ActivityId": "weapon0006",
+ "__Activity": "weapon0006",
"Remark": "\u51B2\u950B\u67AA",
"Weight": 30,
"WeightType": 2,
@@ -963,25 +795,8 @@
"DefaultAngle": 0,
"UpliftAngleRestore": 1,
"FireEffect": "res://prefab/effect/weapon/ShotFire.tscn",
- "BulletId": "0002",
- "HarmRange": [
- 3
- ],
- "RepelRnage": [
- 10
- ],
- "BulletDeviationAngleRange": [
- 0
- ],
- "BulletSpeedRange": [
- 320,
- 340
- ],
- "BulletDistanceRange": [
- 300,
- 400
- ],
- "ShellId": "shell0001",
+ "__Bullet": "0002",
+ "__Shell": "shell0001",
"ThrowShellDelayTime": 0,
"ThrowCollisionSize": {
"X": 20,
@@ -1009,7 +824,7 @@
},
{
"Id": "0012",
- "ActivityId": "",
+ "__Activity": "",
"Remark": "\u51B2\u950B\u67AA",
"Weight": 30,
"WeightType": 2,
@@ -1055,25 +870,8 @@
"DefaultAngle": 0,
"UpliftAngleRestore": 1,
"FireEffect": "res://prefab/effect/weapon/ShotFire.tscn",
- "BulletId": "0002",
- "HarmRange": [
- 3
- ],
- "RepelRnage": [
- 10
- ],
- "BulletDeviationAngleRange": [
- 0
- ],
- "BulletSpeedRange": [
- 320,
- 340
- ],
- "BulletDistanceRange": [
- 300,
- 400
- ],
- "ShellId": "shell0001",
+ "__Bullet": "0002",
+ "__Shell": "shell0001",
"ThrowShellDelayTime": 0,
"ThrowCollisionSize": {
"X": 20,
@@ -1101,7 +899,7 @@
},
{
"Id": "0013",
- "ActivityId": "weapon0007",
+ "__Activity": "weapon0007",
"Remark": "\u6C64\u59C6\u900A\u51B2\u950B\u67AA",
"Weight": 40,
"WeightType": 2,
@@ -1147,25 +945,8 @@
"DefaultAngle": 0,
"UpliftAngleRestore": 1,
"FireEffect": "res://prefab/effect/weapon/ShotFire.tscn",
- "BulletId": "0003",
- "HarmRange": [
- 3
- ],
- "RepelRnage": [
- 15
- ],
- "BulletDeviationAngleRange": [
- 0
- ],
- "BulletSpeedRange": [
- 300,
- 330
- ],
- "BulletDistanceRange": [
- 270,
- 360
- ],
- "ShellId": "shell0001",
+ "__Bullet": "0003",
+ "__Shell": "shell0001",
"ThrowShellDelayTime": 0,
"ThrowCollisionSize": {
"X": 20,
@@ -1193,7 +974,7 @@
},
{
"Id": "0014",
- "ActivityId": "",
+ "__Activity": "",
"Remark": "\u6C64\u59C6\u900A\u51B2\u950B\u67AA",
"Weight": 40,
"WeightType": 2,
@@ -1239,25 +1020,8 @@
"DefaultAngle": 0,
"UpliftAngleRestore": 1,
"FireEffect": "res://prefab/effect/weapon/ShotFire.tscn",
- "BulletId": "0003",
- "HarmRange": [
- 3
- ],
- "RepelRnage": [
- 15
- ],
- "BulletDeviationAngleRange": [
- 0
- ],
- "BulletSpeedRange": [
- 300,
- 330
- ],
- "BulletDistanceRange": [
- 270,
- 360
- ],
- "ShellId": "shell0001",
+ "__Bullet": "0003",
+ "__Shell": "shell0001",
"ThrowShellDelayTime": 0,
"ThrowCollisionSize": {
"X": 20,
@@ -1285,7 +1049,7 @@
},
{
"Id": "0015",
- "ActivityId": "weapon0008",
+ "__Activity": "weapon0008",
"Remark": "\u6FC0\u5149\u624B\u67AA",
"Weight": 40,
"WeightType": 1,
@@ -1331,25 +1095,8 @@
"DefaultAngle": 0,
"UpliftAngleRestore": 1,
"FireEffect": "res://prefab/effect/weapon/ShotFire2.tscn",
- "BulletId": "1001",
- "HarmRange": [
- 5
- ],
- "RepelRnage": [
- 0
- ],
- "BulletDeviationAngleRange": [
- 0
- ],
- "BulletSpeedRange": [
- 300,
- 330
- ],
- "BulletDistanceRange": [
- 270,
- 360
- ],
- "ShellId": "",
+ "__Bullet": "1001",
+ "__Shell": "",
"ThrowShellDelayTime": 0,
"ThrowCollisionSize": {
"X": 20,
@@ -1377,7 +1124,7 @@
},
{
"Id": "0016",
- "ActivityId": "",
+ "__Activity": "",
"Remark": "\u6FC0\u5149\u624B\u67AA",
"Weight": 40,
"WeightType": 1,
@@ -1423,25 +1170,8 @@
"DefaultAngle": 0,
"UpliftAngleRestore": 1,
"FireEffect": "res://prefab/effect/weapon/ShotFire2.tscn",
- "BulletId": "1001",
- "HarmRange": [
- 5
- ],
- "RepelRnage": [
- 0
- ],
- "BulletDeviationAngleRange": [
- 0
- ],
- "BulletSpeedRange": [
- 300,
- 330
- ],
- "BulletDistanceRange": [
- 270,
- 360
- ],
- "ShellId": "",
+ "__Bullet": "1001",
+ "__Shell": "",
"ThrowShellDelayTime": 0,
"ThrowCollisionSize": {
"X": 20,
@@ -1469,7 +1199,7 @@
},
{
"Id": "0017",
- "ActivityId": "weapon0009",
+ "__Activity": "weapon0009",
"Remark": "\u69B4\u5F39\u53D1\u5C04\u5668",
"Weight": 40,
"WeightType": 1,
@@ -1515,25 +1245,8 @@
"DefaultAngle": 0,
"UpliftAngleRestore": 1,
"FireEffect": "res://prefab/effect/weapon/ShotFire2.tscn",
- "BulletId": "1001",
- "HarmRange": [
- 5
- ],
- "RepelRnage": [
- 0
- ],
- "BulletDeviationAngleRange": [
- 0
- ],
- "BulletSpeedRange": [
- 300,
- 330
- ],
- "BulletDistanceRange": [
- 270,
- 360
- ],
- "ShellId": "",
+ "__Bullet": "0004",
+ "__Shell": "",
"ThrowShellDelayTime": 0,
"ThrowCollisionSize": {
"X": 20,
diff --git a/DungeonShooting_Godot/resource/sprite/bullet/normal/bullet0004.png b/DungeonShooting_Godot/resource/sprite/bullet/normal/bullet0004.png
new file mode 100644
index 0000000..0340c18
--- /dev/null
+++ b/DungeonShooting_Godot/resource/sprite/bullet/normal/bullet0004.png
Binary files differ
diff --git a/DungeonShooting_Godot/resource/sprite/bullet/normal/bullet0004.png.import b/DungeonShooting_Godot/resource/sprite/bullet/normal/bullet0004.png.import
new file mode 100644
index 0000000..3b32b1a
--- /dev/null
+++ b/DungeonShooting_Godot/resource/sprite/bullet/normal/bullet0004.png.import
@@ -0,0 +1,34 @@
+[remap]
+
+importer="texture"
+type="CompressedTexture2D"
+uid="uid://c25xd887txviq"
+path="res://.godot/imported/bullet0004.png-998e96e7c171c50fe5b23ce64ab09962.ctex"
+metadata={
+"vram_texture": false
+}
+
+[deps]
+
+source_file="res://resource/sprite/bullet/normal/bullet0004.png"
+dest_files=["res://.godot/imported/bullet0004.png-998e96e7c171c50fe5b23ce64ab09962.ctex"]
+
+[params]
+
+compress/mode=0
+compress/high_quality=false
+compress/lossy_quality=0.7
+compress/hdr_compression=1
+compress/normal_map=0
+compress/channel_pack=0
+mipmaps/generate=false
+mipmaps/limit=-1
+roughness/mode=0
+roughness/src_normal=""
+process/fix_alpha_border=true
+process/premult_alpha=false
+process/normal_map_invert_y=false
+process/hdr_as_srgb=false
+process/hdr_clamp_exposure=false
+process/size_limit=0
+detect_3d/compress_to=1
diff --git a/DungeonShooting_Godot/resource/spriteFrames/bullet/Bullet0004.tres b/DungeonShooting_Godot/resource/spriteFrames/bullet/Bullet0004.tres
new file mode 100644
index 0000000..d3bc716
--- /dev/null
+++ b/DungeonShooting_Godot/resource/spriteFrames/bullet/Bullet0004.tres
@@ -0,0 +1,86 @@
+[gd_resource type="SpriteFrames" load_steps=12 format=3 uid="uid://d3vma1qjo478l"]
+
+[ext_resource type="Texture2D" uid="uid://c25xd887txviq" path="res://resource/sprite/bullet/normal/bullet0004.png" id="1_qrd7l"]
+
+[sub_resource type="AtlasTexture" id="AtlasTexture_q5ryk"]
+atlas = ExtResource("1_qrd7l")
+region = Rect2(0, 0, 5, 5)
+
+[sub_resource type="AtlasTexture" id="AtlasTexture_fbk6r"]
+atlas = ExtResource("1_qrd7l")
+region = Rect2(0, 0, 5, 5)
+
+[sub_resource type="AtlasTexture" id="AtlasTexture_ppiqe"]
+atlas = ExtResource("1_qrd7l")
+region = Rect2(5, 0, 5, 5)
+
+[sub_resource type="AtlasTexture" id="AtlasTexture_aympx"]
+atlas = ExtResource("1_qrd7l")
+region = Rect2(10, 0, 5, 5)
+
+[sub_resource type="AtlasTexture" id="AtlasTexture_u5kch"]
+atlas = ExtResource("1_qrd7l")
+region = Rect2(15, 0, 5, 5)
+
+[sub_resource type="AtlasTexture" id="AtlasTexture_jiimt"]
+atlas = ExtResource("1_qrd7l")
+region = Rect2(20, 0, 5, 5)
+
+[sub_resource type="AtlasTexture" id="AtlasTexture_wtb8v"]
+atlas = ExtResource("1_qrd7l")
+region = Rect2(25, 0, 5, 5)
+
+[sub_resource type="AtlasTexture" id="AtlasTexture_45dah"]
+atlas = ExtResource("1_qrd7l")
+region = Rect2(30, 0, 5, 5)
+
+[sub_resource type="AtlasTexture" id="AtlasTexture_s472h"]
+atlas = ExtResource("1_qrd7l")
+region = Rect2(35, 0, 5, 5)
+
+[sub_resource type="AtlasTexture" id="AtlasTexture_xy2vr"]
+atlas = ExtResource("1_qrd7l")
+region = Rect2(40, 0, 5, 5)
+
+[resource]
+animations = [{
+"frames": [{
+"duration": 1.0,
+"texture": SubResource("AtlasTexture_q5ryk")
+}],
+"loop": true,
+"name": &"default",
+"speed": 5.0
+}, {
+"frames": [{
+"duration": 1.0,
+"texture": SubResource("AtlasTexture_fbk6r")
+}, {
+"duration": 1.0,
+"texture": SubResource("AtlasTexture_ppiqe")
+}, {
+"duration": 1.0,
+"texture": SubResource("AtlasTexture_aympx")
+}, {
+"duration": 1.0,
+"texture": SubResource("AtlasTexture_u5kch")
+}, {
+"duration": 1.0,
+"texture": SubResource("AtlasTexture_jiimt")
+}, {
+"duration": 1.0,
+"texture": SubResource("AtlasTexture_wtb8v")
+}, {
+"duration": 1.0,
+"texture": SubResource("AtlasTexture_45dah")
+}, {
+"duration": 1.0,
+"texture": SubResource("AtlasTexture_s472h")
+}, {
+"duration": 1.0,
+"texture": SubResource("AtlasTexture_xy2vr")
+}],
+"loop": true,
+"name": &"move",
+"speed": 10.0
+}]
diff --git a/DungeonShooting_Godot/src/config/ExcelConfig.cs b/DungeonShooting_Godot/src/config/ExcelConfig.cs
index b0e7216..931fc29 100644
--- a/DungeonShooting_Godot/src/config/ExcelConfig.cs
+++ b/DungeonShooting_Godot/src/config/ExcelConfig.cs
@@ -167,6 +167,21 @@
{
try
{
+ if (!string.IsNullOrEmpty(item.__Activity))
+ {
+ item.Activity = ActivityBase_Map[item.__Activity];
+ }
+
+ if (!string.IsNullOrEmpty(item.__Bullet))
+ {
+ item.Bullet = BulletBase_Map[item.__Bullet];
+ }
+
+ if (!string.IsNullOrEmpty(item.__Shell))
+ {
+ item.Shell = ActivityBase_Map[item.__Shell];
+ }
+
if (!string.IsNullOrEmpty(item.__ShootSound))
{
item.ShootSound = Sound_Map[item.__ShootSound];
diff --git a/DungeonShooting_Godot/src/config/ExcelConfig_ActivityBase.cs b/DungeonShooting_Godot/src/config/ExcelConfig_ActivityBase.cs
index 7f52d37..ffae5fd 100644
--- a/DungeonShooting_Godot/src/config/ExcelConfig_ActivityBase.cs
+++ b/DungeonShooting_Godot/src/config/ExcelConfig_ActivityBase.cs
@@ -49,6 +49,12 @@
public string Details;
///
+ /// 是否是静态物体
+ ///
+ [JsonInclude]
+ public bool IsStatic;
+
+ ///
/// 物体预制场景路径, 场景根节点必须是ActivityObject子类
///
[JsonInclude]
@@ -78,6 +84,7 @@
inst.Name = Name;
inst.Intro = Intro;
inst.Details = Details;
+ inst.IsStatic = IsStatic;
inst.Prefab = Prefab;
inst.Icon = Icon;
inst.ShowInMapEditor = ShowInMapEditor;
diff --git a/DungeonShooting_Godot/src/config/ExcelConfig_BulletBase.cs b/DungeonShooting_Godot/src/config/ExcelConfig_BulletBase.cs
index 6d04907..b1bc443 100644
--- a/DungeonShooting_Godot/src/config/ExcelConfig_BulletBase.cs
+++ b/DungeonShooting_Godot/src/config/ExcelConfig_BulletBase.cs
@@ -22,7 +22,8 @@
///
/// 子弹类型:
/// 实体子弹:1
- /// 激光子弹:2
+ /// 激光子弹:2
+ /// 纯伤害:3
///
[JsonInclude]
public int Type;
@@ -30,12 +31,65 @@
///
/// 绑定子弹预制体,根据Type填不同的参数
/// Type为1,填ActivityBase表Id
- /// Type为2,填场景路径
+ /// Type为2,填场景路径
+ /// Type为3,不填
///
[JsonInclude]
public string Prefab;
///
+ /// 造成的伤害区间
+ /// 格式为[value]或者[min,max]
+ ///
+ [JsonInclude]
+ public int[] HarmRange;
+
+ ///
+ /// 造成伤害后击退值区间
+ /// 如果发射子弹,则按每发子弹算击退
+ /// 格式为[value]或者[min,max]
+ ///
+ [JsonInclude]
+ public float[] RepelRnage;
+
+ ///
+ /// 子弹偏移角度区间
+ /// 用于设置子弹偏移朝向, 该属性和射半径效果类似, 但与其不同的是, 散射半径是用来控制枪口朝向的, 而该属性是控制子弹朝向的, 可用于制作霰弹枪子弹效果
+ /// 格式为[value]或者[min,max]
+ ///
+ [JsonInclude]
+ public float[] DeviationAngleRange;
+
+ ///
+ /// 子弹初速度区间
+ /// 格式为[value]或者[min,max]
+ ///
+ [JsonInclude]
+ public float[] SpeedRange;
+
+ ///
+ /// 子弹最大存在时间,单位:秒
+ /// 如果值小于等于0时子弹无限期存在
+ /// 格式为[value]或者[min,max]
+ ///
+ [JsonInclude]
+ public float[] LifeTimeRange;
+
+ ///
+ /// 子弹最大飞行距离区间
+ /// 格式为[value]或者[min,max]
+ ///
+ [JsonInclude]
+ public float[] DistanceRange;
+
+ ///
+ /// 是否开启重力下坠
+ /// 只有Type为1时才需要填写
+ ///
+ [JsonInclude]
+ public bool UseGravity;
+
+ ///
/// 返回浅拷贝出的新对象
///
public BulletBase Clone()
@@ -45,6 +99,13 @@
inst.Name = Name;
inst.Type = Type;
inst.Prefab = Prefab;
+ inst.HarmRange = HarmRange;
+ inst.RepelRnage = RepelRnage;
+ inst.DeviationAngleRange = DeviationAngleRange;
+ inst.SpeedRange = SpeedRange;
+ inst.LifeTimeRange = LifeTimeRange;
+ inst.DistanceRange = DistanceRange;
+ inst.UseGravity = UseGravity;
return inst;
}
}
diff --git a/DungeonShooting_Godot/src/config/ExcelConfig_WeaponBase.cs b/DungeonShooting_Godot/src/config/ExcelConfig_WeaponBase.cs
index df706cf..f89a4ea 100644
--- a/DungeonShooting_Godot/src/config/ExcelConfig_WeaponBase.cs
+++ b/DungeonShooting_Godot/src/config/ExcelConfig_WeaponBase.cs
@@ -16,8 +16,7 @@
///
/// 属性绑定武器的Id,这个id时ActivityBase表Id,如果是Ai使用的数据, 则填空字符串串
///
- [JsonInclude]
- public string ActivityId;
+ public ActivityBase Activity;
///
/// 备注
@@ -254,57 +253,18 @@
public string FireEffect;
///
- /// 默认射出的子弹,BulletBase表Id
+ /// 默认射出的子弹
///
- [JsonInclude]
- public string BulletId;
-
- ///
- /// 造成的伤害区间
- /// 格式为[value]或者[min,max]
- ///
- [JsonInclude]
- public int[] HarmRange;
-
- ///
- /// 造成伤害后击退值区间
- /// 如果发射子弹,则按每发子弹算击退
- /// 格式为[value]或者[min,max]
- ///
- [JsonInclude]
- public float[] RepelRnage;
-
- ///
- /// 子弹偏移角度区间
- /// 用于设置子弹偏移朝向, 该属性和射半径效果类似, 但与其不同的是, 散射半径是用来控制枪口朝向的, 而该属性是控制子弹朝向的, 可用于制作霰弹枪子弹效果
- /// 格式为[value]或者[min,max]
- ///
- [JsonInclude]
- public float[] BulletDeviationAngleRange;
-
- ///
- /// 子弹初速度区间
- /// 格式为[value]或者[min,max]
- ///
- [JsonInclude]
- public float[] BulletSpeedRange;
-
- ///
- /// 子弹飞行距离区间
- /// 格式为[value]或者[min,max]
- ///
- [JsonInclude]
- public float[] BulletDistanceRange;
+ public BulletBase Bullet;
///
/// 默认抛出的弹壳
///
- [JsonInclude]
- public string ShellId;
+ public ActivityBase Shell;
///
/// 投抛弹壳的延时时间, 在射击或者上膛后会触发抛弹壳效果
- /// 如果为负数, 则不自动抛弹
+ /// 如果为0, 则不自动抛弹
///
[JsonInclude]
public float ThrowShellDelayTime;
@@ -410,7 +370,7 @@
{
var inst = new WeaponBase();
inst.Id = Id;
- inst.ActivityId = ActivityId;
+ inst.Activity = Activity;
inst.Remark = Remark;
inst.Weight = Weight;
inst.WeightType = WeightType;
@@ -449,13 +409,8 @@
inst.DefaultAngle = DefaultAngle;
inst.UpliftAngleRestore = UpliftAngleRestore;
inst.FireEffect = FireEffect;
- inst.BulletId = BulletId;
- inst.HarmRange = HarmRange;
- inst.RepelRnage = RepelRnage;
- inst.BulletDeviationAngleRange = BulletDeviationAngleRange;
- inst.BulletSpeedRange = BulletSpeedRange;
- inst.BulletDistanceRange = BulletDistanceRange;
- inst.ShellId = ShellId;
+ inst.Bullet = Bullet;
+ inst.Shell = Shell;
inst.ThrowShellDelayTime = ThrowShellDelayTime;
inst.ThrowCollisionSize = ThrowCollisionSize;
inst.CanMeleeAttack = CanMeleeAttack;
@@ -479,6 +434,15 @@
private class Ref_WeaponBase : WeaponBase
{
[JsonInclude]
+ public string __Activity;
+
+ [JsonInclude]
+ public string __Bullet;
+
+ [JsonInclude]
+ public string __Shell;
+
+ [JsonInclude]
public string __ShootSound;
[JsonInclude]
diff --git a/DungeonShooting_Godot/src/framework/activity/ActivityObject.cs b/DungeonShooting_Godot/src/framework/activity/ActivityObject.cs
index eeff1fd..77ceeba 100644
--- a/DungeonShooting_Godot/src/framework/activity/ActivityObject.cs
+++ b/DungeonShooting_Godot/src/framework/activity/ActivityObject.cs
@@ -319,7 +319,7 @@
private FreezeSprite _freezeSprite;
//初始化节点
- private void _InitNode(RegisterActivityData activityData, World world)
+ private void _InitNode(ExcelConfig.ActivityBase config, World world)
{
#if TOOLS
if (!Engine.IsEditorHint())
@@ -332,7 +332,7 @@
#endif
ActivityMaterial = new ActivityMaterial();
World = world;
- ItemConfig = activityData.Config;
+ ItemConfig = config;
Name = GetType().Name + (_instanceIndex++);
_blendShaderMaterial = AnimatedSprite.Material as ShaderMaterial;
_shadowBlendShaderMaterial = ShadowSprite.Material as ShaderMaterial;
@@ -1442,6 +1442,19 @@
{
ProxyCoroutineHandler.ProxyStopAllCoroutine(ref _coroutineList);
}
+
+ ///
+ /// 播放 AnimatedSprite 上的动画, 如果没有这个动画, 则什么也不会发生
+ ///
+ /// 动画名称
+ public void PlaySpriteAnimation(string name)
+ {
+ var spriteFrames = AnimatedSprite.SpriteFrames;
+ if (spriteFrames != null && spriteFrames.HasAnimation(name))
+ {
+ AnimatedSprite.Play(name);
+ }
+ }
///
/// 将当前 ActivityObject 变成静态图像绘制到地面上, 用于优化渲染大量物体
@@ -1479,6 +1492,9 @@
return _processingBecomesStaticImage;
}
+ ///
+ /// 冻结物体,多余的节点就会被移出场景树,逻辑也会被暂停,用于优化性能
+ ///
public void Freeze()
{
if (_freezeSprite == null)
@@ -1488,6 +1504,9 @@
_freezeSprite.Freeze();
}
+ ///
+ /// 解冻物体, 恢复正常逻辑
+ ///
public void Unfreeze()
{
if (_freezeSprite == null)
diff --git a/DungeonShooting_Godot/src/framework/activity/ActivityObject_Create.cs b/DungeonShooting_Godot/src/framework/activity/ActivityObject_Create.cs
new file mode 100644
index 0000000..ebc901a
--- /dev/null
+++ b/DungeonShooting_Godot/src/framework/activity/ActivityObject_Create.cs
@@ -0,0 +1,55 @@
+
+using System;
+using Config;
+
+public partial class ActivityObject
+{
+ ///
+ /// 通过 ActivityBase 实例化 ActivityObject 对象
+ ///
+ public static ActivityObject Create(ExcelConfig.ActivityBase config)
+ {
+ var world = GameApplication.Instance.World;
+ if (world == null)
+ {
+ throw new Exception("实例化 ActivityObject 前请先调用 'GameApplication.Instance.CreateNewWorld()' 初始化 World 对象");
+ }
+ var instance = ResourceManager.LoadAndInstantiate(config.Prefab);
+ instance._InitNode(config, world);
+ return instance;
+ }
+
+ ///
+ /// 通过 ActivityBase 实例化 ActivityObject 对象
+ ///
+ public static T Create(ExcelConfig.ActivityBase config) where T : ActivityObject
+ {
+ return (T)Create(config);
+ }
+
+ ///
+ /// 通过 ItemId 实例化 ActivityObject 对象
+ ///
+ public static ActivityObject Create(string itemId)
+ {
+ if (ExcelConfig.ActivityBase_Map.TryGetValue(itemId, out var config))
+ {
+ return Create(config);
+ }
+ Debug.LogError("创建实例失败, 未找到id为'" + itemId + "'的物体!");
+ return null;
+ }
+
+ ///
+ /// 通过 ItemId 实例化 ActivityObject 对象
+ ///
+ public static T Create(string itemId) where T : ActivityObject
+ {
+ var instance = Create(itemId);
+ if (instance != null)
+ {
+ return (T)instance;
+ }
+ return null;
+ }
+}
\ No newline at end of file
diff --git a/DungeonShooting_Godot/src/framework/activity/ActivityObject_Init.cs b/DungeonShooting_Godot/src/framework/activity/ActivityObject_Init.cs
index 47d68f0..9a8b289 100644
--- a/DungeonShooting_Godot/src/framework/activity/ActivityObject_Init.cs
+++ b/DungeonShooting_Godot/src/framework/activity/ActivityObject_Init.cs
@@ -82,6 +82,11 @@
/// 名称:
/// 简介:
///
+ public const string Id_bullet0004 = "bullet0004";
+ ///
+ /// 名称:
+ /// 简介:
+ ///
public const string Id_shell0001 = "shell0001";
///
/// 名称:
@@ -179,41 +184,4 @@
///
public const string Id_other_door_n = "other_door_n";
}
- private static void _InitRegister()
- {
- _activityRegisterMap.Add("role0001", new RegisterActivityData("res://prefab/role/Role0001.tscn", ExcelConfig.ActivityBase_Map["role0001"]));
- _activityRegisterMap.Add("enemy0001", new RegisterActivityData("res://prefab/role/Enemy0001.tscn", ExcelConfig.ActivityBase_Map["enemy0001"]));
- _activityRegisterMap.Add("weapon0001", new RegisterActivityData("res://prefab/weapon/Weapon0001.tscn", ExcelConfig.ActivityBase_Map["weapon0001"]));
- _activityRegisterMap.Add("weapon0002", new RegisterActivityData("res://prefab/weapon/Weapon0002.tscn", ExcelConfig.ActivityBase_Map["weapon0002"]));
- _activityRegisterMap.Add("weapon0003", new RegisterActivityData("res://prefab/weapon/Weapon0003.tscn", ExcelConfig.ActivityBase_Map["weapon0003"]));
- _activityRegisterMap.Add("weapon0004", new RegisterActivityData("res://prefab/weapon/Weapon0004.tscn", ExcelConfig.ActivityBase_Map["weapon0004"]));
- _activityRegisterMap.Add("weapon0005", new RegisterActivityData("res://prefab/weapon/Weapon0005.tscn", ExcelConfig.ActivityBase_Map["weapon0005"]));
- _activityRegisterMap.Add("weapon0006", new RegisterActivityData("res://prefab/weapon/Weapon0006.tscn", ExcelConfig.ActivityBase_Map["weapon0006"]));
- _activityRegisterMap.Add("weapon0007", new RegisterActivityData("res://prefab/weapon/Weapon0007.tscn", ExcelConfig.ActivityBase_Map["weapon0007"]));
- _activityRegisterMap.Add("weapon0008", new RegisterActivityData("res://prefab/weapon/Weapon0008.tscn", ExcelConfig.ActivityBase_Map["weapon0008"]));
- _activityRegisterMap.Add("weapon0009", new RegisterActivityData("res://prefab/weapon/Weapon0009.tscn", ExcelConfig.ActivityBase_Map["weapon0009"]));
- _activityRegisterMap.Add("bullet0001", new RegisterActivityData("res://prefab/bullet/normal/Bullet0001.tscn", ExcelConfig.ActivityBase_Map["bullet0001"]));
- _activityRegisterMap.Add("bullet0002", new RegisterActivityData("res://prefab/bullet/normal/Bullet0002.tscn", ExcelConfig.ActivityBase_Map["bullet0002"]));
- _activityRegisterMap.Add("bullet0003", new RegisterActivityData("res://prefab/bullet/normal/Bullet0003.tscn", ExcelConfig.ActivityBase_Map["bullet0003"]));
- _activityRegisterMap.Add("shell0001", new RegisterActivityData("res://prefab/shell/Shell0001.tscn", ExcelConfig.ActivityBase_Map["shell0001"]));
- _activityRegisterMap.Add("shell0002", new RegisterActivityData("res://prefab/shell/Shell0002.tscn", ExcelConfig.ActivityBase_Map["shell0002"]));
- _activityRegisterMap.Add("shell0003", new RegisterActivityData("res://prefab/shell/Shell0003.tscn", ExcelConfig.ActivityBase_Map["shell0003"]));
- _activityRegisterMap.Add("effect0001", new RegisterActivityData("res://prefab/effect/enemy/Effect0001.tscn", ExcelConfig.ActivityBase_Map["effect0001"]));
- _activityRegisterMap.Add("prop0001", new RegisterActivityData("res://prefab/effect/enemy/Effect0001.tscn", ExcelConfig.ActivityBase_Map["prop0001"]));
- _activityRegisterMap.Add("prop0002", new RegisterActivityData("res://prefab/prop/buff/BuffProp0002.tscn", ExcelConfig.ActivityBase_Map["prop0002"]));
- _activityRegisterMap.Add("prop0003", new RegisterActivityData("res://prefab/prop/buff/BuffProp0003.tscn", ExcelConfig.ActivityBase_Map["prop0003"]));
- _activityRegisterMap.Add("prop0004", new RegisterActivityData("res://prefab/prop/buff/BuffProp0004.tscn", ExcelConfig.ActivityBase_Map["prop0004"]));
- _activityRegisterMap.Add("prop0005", new RegisterActivityData("res://prefab/prop/buff/BuffProp0005.tscn", ExcelConfig.ActivityBase_Map["prop0005"]));
- _activityRegisterMap.Add("prop0006", new RegisterActivityData("res://prefab/prop/buff/BuffProp0006.tscn", ExcelConfig.ActivityBase_Map["prop0006"]));
- _activityRegisterMap.Add("prop0007", new RegisterActivityData("res://prefab/prop/buff/BuffProp0007.tscn", ExcelConfig.ActivityBase_Map["prop0007"]));
- _activityRegisterMap.Add("prop0008", new RegisterActivityData("res://prefab/prop/buff/BuffProp0008.tscn", ExcelConfig.ActivityBase_Map["prop0008"]));
- _activityRegisterMap.Add("prop0009", new RegisterActivityData("res://prefab/prop/buff/BuffProp0009.tscn", ExcelConfig.ActivityBase_Map["prop0009"]));
- _activityRegisterMap.Add("prop0010", new RegisterActivityData("res://prefab/prop/buff/BuffProp0010.tscn", ExcelConfig.ActivityBase_Map["prop0010"]));
- _activityRegisterMap.Add("prop5000", new RegisterActivityData("res://prefab/prop/active/ActiveProp5000.tscn", ExcelConfig.ActivityBase_Map["prop5000"]));
- _activityRegisterMap.Add("prop5001", new RegisterActivityData("res://prefab/prop/active/ActiveProp5001.tscn", ExcelConfig.ActivityBase_Map["prop5001"]));
- _activityRegisterMap.Add("other_door_e", new RegisterActivityData("res://prefab/map/RoomDoor_E.tscn", ExcelConfig.ActivityBase_Map["other_door_e"]));
- _activityRegisterMap.Add("other_door_w", new RegisterActivityData("res://prefab/map/RoomDoor_W.tscn", ExcelConfig.ActivityBase_Map["other_door_w"]));
- _activityRegisterMap.Add("other_door_s", new RegisterActivityData("res://prefab/map/RoomDoor_S.tscn", ExcelConfig.ActivityBase_Map["other_door_s"]));
- _activityRegisterMap.Add("other_door_n", new RegisterActivityData("res://prefab/map/RoomDoor_N.tscn", ExcelConfig.ActivityBase_Map["other_door_n"]));
- }
}
diff --git a/DungeonShooting_Godot/src/framework/activity/ActivityObject_Register.cs b/DungeonShooting_Godot/src/framework/activity/ActivityObject_Register.cs
deleted file mode 100644
index d5126dd..0000000
--- a/DungeonShooting_Godot/src/framework/activity/ActivityObject_Register.cs
+++ /dev/null
@@ -1,72 +0,0 @@
-
-using System;
-using System.Collections.Generic;
-using Config;
-using Godot;
-
-public partial class ActivityObject
-{
- private class RegisterActivityData
- {
- public RegisterActivityData(string path, ExcelConfig.ActivityBase config)
- {
- Path = path;
- Config = config;
- }
-
- public string Path;
- public ExcelConfig.ActivityBase Config;
- }
-
- //负责存放所有注册对象数据
- private static Dictionary _activityRegisterMap = new Dictionary();
- private static bool _initState = false;
-
- ///
- /// 初始化调用, 开始扫描当前程序集, 并自动注册 ActivityObject 物体
- ///
- public static void InitActivity()
- {
- if (_initState)
- {
- return;
- }
-
- _initState = true;
- _InitRegister();
- }
-
- ///
- /// 通过 ItemId 实例化 ActivityObject 对象
- ///
- public static ActivityObject Create(string itemId)
- {
- var world = GameApplication.Instance.World;
- if (world == null)
- {
- throw new Exception("实例化 ActivityObject 前请先调用 'GameApplication.Instance.CreateNewWorld()' 初始化 World 对象");
- }
-
- if (_activityRegisterMap.TryGetValue(itemId, out var config))
- {
- var instance = ResourceManager.LoadAndInstantiate(config.Path);
- instance._InitNode(config, world);
- return instance;
- }
- Debug.LogError("创建实例失败, 未找到id为'" + itemId + "'的物体!");
- return null;
- }
-
- ///
- /// 通过 ItemId 实例化 ActivityObject 对象
- ///
- public static T Create(string itemId) where T : ActivityObject
- {
- var instance = Create(itemId);
- if (instance != null)
- {
- return (T)instance;
- }
- return null;
- }
-}
\ No newline at end of file
diff --git a/DungeonShooting_Godot/src/framework/generator/ExcelGenerator.cs b/DungeonShooting_Godot/src/framework/generator/ExcelGenerator.cs
index f4ff446..86bfa6d 100644
--- a/DungeonShooting_Godot/src/framework/generator/ExcelGenerator.cs
+++ b/DungeonShooting_Godot/src/framework/generator/ExcelGenerator.cs
@@ -38,10 +38,9 @@
private static void GeneratorActivityObjectInit()
{
var text = File.ReadAllText($"resource/config/{nameof(ExcelConfig.ActivityBase)}.json");
- var array = JsonSerializer.Deserialize[]>(text);
+ var array = JsonSerializer.Deserialize[]>(text);
var code1 = "";
- var code2 = "";
foreach (var item in array)
{
@@ -53,7 +52,6 @@
code1 += $" /// 简介: {intro.Replace("\n", "
\n /// ")}\n";
code1 += $" /// \n";
code1 += $" public const string Id_{id} = \"{id}\";\n";
- code2 += $" _activityRegisterMap.Add(\"{id}\", new RegisterActivityData(\"{item["Prefab"]}\", ExcelConfig.ActivityBase_Map[\"{id}\"]));\n";
}
var str = $"using Config;\n\n";
@@ -69,10 +67,6 @@
str += code1;
str += $" }}\n";
- str += $" private static void _InitRegister()\n";
- str += $" {{\n";
- str += code2;
- str += $" }}\n";
str += $"}}\n";
File.WriteAllText("src/framework/activity/ActivityObject_Init.cs", str);
diff --git a/DungeonShooting_Godot/src/game/AnimatorNames.cs b/DungeonShooting_Godot/src/game/AnimatorNames.cs
index 63ee6b3..b393c9f 100644
--- a/DungeonShooting_Godot/src/game/AnimatorNames.cs
+++ b/DungeonShooting_Godot/src/game/AnimatorNames.cs
@@ -64,4 +64,8 @@
/// 播放特效
///
public const string Play = "play";
+ ///
+ /// 物体移动
+ ///
+ public const string Move = "move";
}
\ No newline at end of file
diff --git a/DungeonShooting_Godot/src/game/GameApplication.cs b/DungeonShooting_Godot/src/game/GameApplication.cs
index 3769340..da85dc2 100644
--- a/DungeonShooting_Godot/src/game/GameApplication.cs
+++ b/DungeonShooting_Godot/src/game/GameApplication.cs
@@ -95,8 +95,6 @@
ExcelConfig.Init();
//初始化房间配置数据
InitRoomConfig();
- //初始化 ActivityObject
- ActivityObject.InitActivity();
//初始化武器数据
Weapon.InitWeaponAttribute();
diff --git a/DungeonShooting_Godot/src/game/activity/bullet/laser/Laser.cs b/DungeonShooting_Godot/src/game/activity/bullet/laser/Laser.cs
index 4039b4e..32a873d 100644
--- a/DungeonShooting_Godot/src/game/activity/bullet/laser/Laser.cs
+++ b/DungeonShooting_Godot/src/game/activity/bullet/laser/Laser.cs
@@ -1,5 +1,6 @@
using System.Collections;
using System.Collections.Generic;
+using Config;
using Godot;
///
@@ -16,8 +17,9 @@
get => CollisionMask;
set => CollisionMask = value;
}
- public Weapon Weapon { get; private set; }
- public Role TriggerRole { get; private set; }
+ public Weapon Weapon { get; set; }
+ public ExcelConfig.BulletBase BulletBase { get; set; }
+ public Role TriggerRole { get; set; }
///
/// 最小伤害
@@ -30,6 +32,9 @@
public int MaxHarm { get; set; } = 4;
public bool IsDestroyed { get; private set; }
+
+ public float Width { get; set; }
+
//开启的协程
private List _coroutineList;
private float _pixelScale;
@@ -45,17 +50,13 @@
AreaEntered += OnArea2dEntered;
}
-
- public void Init(Weapon weapon, uint targetLayer)
+
+ public void Init(Weapon weapon, uint attackLayer, Vector2 position, float rotation, float width, float distance)
{
TriggerRole = weapon.TriggerRole;
Weapon = weapon;
- AttackLayer = targetLayer;
- }
-
- public void Init(Weapon weapon, uint targetLayer, Vector2 position, float rotation, float width, float distance)
- {
- Init(weapon, targetLayer);
+ AttackLayer = attackLayer;
+
Position = position;
Rotation = rotation;
@@ -74,7 +75,7 @@
LineSprite.Scale = new Vector2(0, width * _pixelScale);
//如果子弹会对玩家造成伤害, 则显示成红色
- if (Player.Current.CollisionWithMask(targetLayer))
+ if (Player.Current.CollisionWithMask(attackLayer))
{
LineSprite.Modulate = new Color(2.5f, 0.5f, 0.5f);
}
diff --git a/DungeonShooting_Godot/src/game/activity/bullet/normal/Bullet.cs b/DungeonShooting_Godot/src/game/activity/bullet/normal/Bullet.cs
index 72aacb1..50570ea 100644
--- a/DungeonShooting_Godot/src/game/activity/bullet/normal/Bullet.cs
+++ b/DungeonShooting_Godot/src/game/activity/bullet/normal/Bullet.cs
@@ -1,4 +1,5 @@
using System.Collections;
+using Config;
using Godot;
///
@@ -25,7 +26,9 @@
///
/// 发射该子弹的武器
///
- public Weapon Weapon { get; private set; }
+ public Weapon Weapon { get; set; }
+
+ public ExcelConfig.BulletBase BulletBase { get; set; }
///
/// 最小伤害
@@ -40,10 +43,12 @@
///
/// 发射该子弹的角色
///
- public Role TriggerRole { get; private set; }
+ public Role TriggerRole { get; set; }
- // 最大飞行距离
- private float MaxDistance;
+ ///
+ /// 最大飞行距离
+ ///
+ public float MaxDistance { get; set; }
// 子弹飞行速度
private float FlySpeed;
@@ -51,15 +56,13 @@
//当前子弹已经飞行的距离
private float CurrFlyDistance = 0;
- public void Init(Weapon weapon, uint targetLayer)
+ public override void OnInit()
{
- TriggerRole = weapon.TriggerRole;
- Weapon = weapon;
- AttackLayer = targetLayer;
+ CollisionArea.AreaEntered += OnArea2dEntered;
}
///
- /// 初始化子弹属性
+ /// 显示红色描边
///
/// 射出该子弹的武器
/// 速度
@@ -69,8 +72,9 @@
/// 攻击目标层级
public void Init(Weapon weapon, float speed, float maxDistance, Vector2 position, float rotation, uint targetLayer)
{
- Init(weapon, targetLayer);
- CollisionArea.AreaEntered += OnArea2dEntered;
+ Weapon = weapon;
+ TriggerRole = weapon.TriggerRole;
+ AttackLayer = targetLayer;
if (TriggerRole == null || !TriggerRole.IsAi) //只有玩家使用该武器才能获得正常速度的子弹
{
@@ -89,11 +93,21 @@
//如果子弹会对玩家造成伤害, 则显示红色描边
if (Player.Current.CollisionWithMask(targetLayer))
{
- ShowOutline = true;
- OutlineColor = new Color(1, 0, 0);
- StartCoroutine(BorderFlashes());
+ ShowBorderFlashes();
}
PutDown(RoomLayerEnum.YSortLayer);
+ //播放子弹移动动画
+ PlaySpriteAnimation(AnimatorNames.Move);
+ }
+
+ ///
+ /// 显示红色描边
+ ///
+ public void ShowBorderFlashes()
+ {
+ ShowOutline = true;
+ OutlineColor = new Color(1, 0, 0);
+ StartCoroutine(BorderFlashes());
}
private IEnumerator BorderFlashes()
@@ -129,18 +143,6 @@
smoke.GlobalPosition = lastSlideCollision.GetPosition();
smoke.GlobalRotation = lastSlideCollision.GetNormal().Angle();
smoke.AddToActivityRoot(RoomLayerEnum.YSortLayer);
-
- //击中爆炸,测试用
- if (TriggerRole == null || !TriggerRole.IsAi)
- {
- var explode = ObjectManager.GetExplode(ResourcePath.prefab_bullet_explode_Explode0001_tscn);
- explode.Position = Position;
- explode.RotationDegrees = Utils.Random.RandomRangeInt(0, 360);
- explode.AddToActivityRoot(RoomLayerEnum.YSortLayer);
- explode.Init(TriggerRole.AffiliationArea, AttackLayer, 25, MinHarm, MaxHarm, 50, 150);
- explode.RunPlay();
- }
-
Destroy();
return;
}
@@ -174,7 +176,7 @@
if (role is not Player) //目标不是玩家才会触发击退
{
var attr = Weapon.GetUseAttribute(TriggerRole);
- var repel = Utils.Random.RandomConfigRange(attr.RepelRnage);
+ var repel = Utils.Random.RandomConfigRange(attr.Bullet.RepelRnage);
if (repel != 0)
{
role.MoveController.AddForce(Vector2.FromAngle(BasisVelocity.Angle()) * repel);
@@ -183,18 +185,6 @@
//造成伤害
role.CallDeferred(nameof(Role.Hurt), damage, Rotation);
-
- //击中爆炸,测试用
- if (TriggerRole == null || !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(TriggerRole.AffiliationArea, AttackLayer, 25, MinHarm, MaxHarm, 50, 150);
- explode.RunPlay();
- }
-
Destroy();
}
}
@@ -203,4 +193,18 @@
{
StopAllCoroutine();
}
+
+ private void TestBoom()
+ {
+ //击中爆炸,测试用
+ if (TriggerRole == null || !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(TriggerRole.AffiliationArea, AttackLayer, 25, MinHarm, MaxHarm, 50, 150);
+ explode.RunPlay();
+ }
+ }
}
\ No newline at end of file
diff --git a/DungeonShooting_Godot/src/game/activity/bullet/normal/IBullet.cs b/DungeonShooting_Godot/src/game/activity/bullet/normal/IBullet.cs
index d6c221a..62165d9 100644
--- a/DungeonShooting_Godot/src/game/activity/bullet/normal/IBullet.cs
+++ b/DungeonShooting_Godot/src/game/activity/bullet/normal/IBullet.cs
@@ -1,4 +1,6 @@
+using Config;
+
public interface IBullet : IDestroy, ICoroutine
{
///
@@ -9,12 +11,17 @@
///
/// 发射该子弹的武器
///
- Weapon Weapon { get; }
+ Weapon Weapon { get; set; }
+
+ ///
+ /// 使用的配置数据
+ ///
+ ExcelConfig.BulletBase BulletBase { get; set; }
///
/// 发射该子弹的角色
///
- Role TriggerRole { get; }
+ Role TriggerRole { get; set; }
///
/// 最小伤害
@@ -25,11 +32,4 @@
/// 最大伤害
///
int MaxHarm { get; set; }
-
- ///
- /// 初始化子弹数据
- ///
- /// 发射该子弹的武器
- /// 攻击的层级
- void Init(Weapon weapon, uint attackLayer);
}
\ No newline at end of file
diff --git a/DungeonShooting_Godot/src/game/activity/role/SubLine.cs b/DungeonShooting_Godot/src/game/activity/role/SubLine.cs
index 33bd409..5f9dd84 100644
--- a/DungeonShooting_Godot/src/game/activity/role/SubLine.cs
+++ b/DungeonShooting_Godot/src/game/activity/role/SubLine.cs
@@ -115,7 +115,7 @@
StopCoroutine(_cid);
_cid = 0;
}
- _range = Utils.GetConfigRangeEnd(weapon.Attribute.BulletDistanceRange);
+ _range = Utils.GetConfigRangeEnd(weapon.Attribute.Bullet.DistanceRange);
_line2D.DefaultColor = _color;
}
}
diff --git a/DungeonShooting_Godot/src/game/activity/role/enemy/Enemy.cs b/DungeonShooting_Godot/src/game/activity/role/enemy/Enemy.cs
index 09c59c3..8de6844 100644
--- a/DungeonShooting_Godot/src/game/activity/role/enemy/Enemy.cs
+++ b/DungeonShooting_Godot/src/game/activity/role/enemy/Enemy.cs
@@ -382,7 +382,7 @@
if (WeaponPack.ActiveItem != null)
{
var attribute = WeaponPack.ActiveItem.Attribute;
- return Mathf.Lerp(Utils.GetConfigRangeStart(attribute.BulletDistanceRange), Utils.GetConfigRangeEnd(attribute.BulletDistanceRange), weight);
+ return Mathf.Lerp(Utils.GetConfigRangeStart(attribute.Bullet.DistanceRange), Utils.GetConfigRangeEnd(attribute.Bullet.DistanceRange), weight);
}
return 0;
diff --git a/DungeonShooting_Godot/src/game/activity/role/enemy/state/AiFollowUpState.cs b/DungeonShooting_Godot/src/game/activity/role/enemy/state/AiFollowUpState.cs
index 50003ec..02d1de1 100644
--- a/DungeonShooting_Godot/src/game/activity/role/enemy/state/AiFollowUpState.cs
+++ b/DungeonShooting_Godot/src/game/activity/role/enemy/state/AiFollowUpState.cs
@@ -110,7 +110,7 @@
Master.EnemyAttack();
//距离够近, 可以切换到环绕模式
- if (Master.GlobalPosition.DistanceSquaredTo(playerPos) <= Mathf.Pow(Utils.GetConfigRangeStart(weapon.Attribute.BulletDistanceRange), 2) * 0.7f)
+ if (Master.GlobalPosition.DistanceSquaredTo(playerPos) <= Mathf.Pow(Utils.GetConfigRangeStart(weapon.Attribute.Bullet.DistanceRange), 2) * 0.7f)
{
ChangeState(AiStateEnum.AiSurround);
}
diff --git a/DungeonShooting_Godot/src/game/activity/role/enemy/state/AiSurroundState.cs b/DungeonShooting_Godot/src/game/activity/role/enemy/state/AiSurroundState.cs
index 321419f..967cc65 100644
--- a/DungeonShooting_Godot/src/game/activity/role/enemy/state/AiSurroundState.cs
+++ b/DungeonShooting_Godot/src/game/activity/role/enemy/state/AiSurroundState.cs
@@ -170,7 +170,7 @@
private void RunOver(Vector2 targetPos)
{
var weapon = Master.WeaponPack.ActiveItem;
- var distance = (int)(weapon == null ? 150 : (Utils.GetConfigRangeStart(weapon.Attribute.BulletDistanceRange) * 0.7f));
+ var distance = (int)(weapon == null ? 150 : (Utils.GetConfigRangeStart(weapon.Attribute.Bullet.DistanceRange) * 0.7f));
_nextPosition = new Vector2(
targetPos.X + Utils.Random.RandomRangeInt(-distance, distance),
targetPos.Y + Utils.Random.RandomRangeInt(-distance, distance)
diff --git a/DungeonShooting_Godot/src/game/activity/weapon/Weapon.cs b/DungeonShooting_Godot/src/game/activity/weapon/Weapon.cs
index 28058f4..efce912 100644
--- a/DungeonShooting_Godot/src/game/activity/weapon/Weapon.cs
+++ b/DungeonShooting_Godot/src/game/activity/weapon/Weapon.cs
@@ -252,9 +252,9 @@
_init = true;
foreach (var weaponAttr in ExcelConfig.WeaponBase_List)
{
- if (!string.IsNullOrEmpty(weaponAttr.ActivityId))
+ if (weaponAttr.Activity != null)
{
- if (!_weaponAttributeMap.TryAdd(weaponAttr.ActivityId, weaponAttr))
+ if (!_weaponAttributeMap.TryAdd(weaponAttr.Activity.Id, weaponAttr))
{
Debug.LogError("发现重复注册的武器属性: " + weaponAttr.Id);
}
@@ -262,11 +262,14 @@
}
}
- private static ExcelConfig.WeaponBase _GetWeaponAttribute(string itemId)
+ ///
+ /// 根据 ActivityBase.Id 获取对应武器的属性数据
+ ///
+ public static ExcelConfig.WeaponBase GetWeaponAttribute(string itemId)
{
if (_weaponAttributeMap.TryGetValue(itemId, out var attr))
{
- return attr.Clone();
+ return attr;
}
throw new Exception($"武器'{itemId}'没有在 Weapon 表中配置属性数据!");
@@ -274,7 +277,7 @@
public override void OnInit()
{
- InitWeapon(_GetWeaponAttribute(ItemConfig.Id));
+ InitWeapon(GetWeaponAttribute(ItemConfig.Id).Clone());
AnimatedSprite.AnimationFinished += OnAnimationFinished;
}
@@ -1446,18 +1449,18 @@
//抛弹逻辑
private void ThrowShellHandler(float speedScale)
{
- if (string.IsNullOrEmpty(Attribute.ShellId))
+ if (Attribute.Shell == null)
{
return;
}
//创建一个弹壳
if (Attribute.ThrowShellDelayTime > 0)
{
- this.CallDelay(Attribute.ThrowShellDelayTime, () => ThrowShell(Attribute.ShellId, speedScale));
+ this.CallDelay(Attribute.ThrowShellDelayTime, () => ThrowShell(Attribute.Shell, speedScale));
}
else if (Attribute.ThrowShellDelayTime == 0)
{
- ThrowShell(Attribute.ShellId, speedScale);
+ ThrowShell(Attribute.Shell, speedScale);
}
}
@@ -1563,16 +1566,6 @@
ReloadFinishHandler();
}
}
-
- //播放动画
- private void PlaySpriteAnimation(string name)
- {
- var spriteFrames = AnimatedSprite.SpriteFrames;
- if (spriteFrames != null && spriteFrames.HasAnimation(name))
- {
- AnimatedSprite.Play(name);
- }
- }
//播放动画
private void PlayAnimationPlayer(string name)
@@ -1894,7 +1887,7 @@
///
/// 投抛弹壳的默认实现方式, shellId为弹壳id
///
- protected ActivityObject ThrowShell(string shellId, float speedScale = 1)
+ protected ActivityObject ThrowShell(ExcelConfig.ActivityBase shell, float speedScale = 1)
{
var startPos = ShellPoint.GlobalPosition;
float startHeight;
@@ -1913,80 +1906,78 @@
var verticalSpeed = Utils.Random.RandomRangeInt((int)(60 * speedScale), (int)(120 * speedScale));
var velocity = new Vector2(Utils.Random.RandomRangeInt((int)(20 * speedScale), (int)(60 * speedScale)), 0).Rotated(direction * Mathf.Pi / 180);
var rotate = Utils.Random.RandomRangeInt((int)(-720 * speedScale), (int)(720 * speedScale));
- var shell = Create(shellId);
- shell.Rotation = (Master != null ? Master.MountPoint.RealRotation : Rotation);
- shell.Throw(startPos, startHeight, verticalSpeed, velocity, rotate);
- shell.InheritVelocity(Master != null ? Master : this);
+ var shellInstance = Create(shell);
+ shellInstance.Rotation = (Master != null ? Master.MountPoint.RealRotation : Rotation);
+ shellInstance.Throw(startPos, startHeight, verticalSpeed, velocity, rotate);
+ shellInstance.InheritVelocity(Master != null ? Master : this);
if (Master == null)
{
- AffiliationArea.InsertItem(shell);
+ AffiliationArea.InsertItem(shellInstance);
}
else
{
- Master.AffiliationArea.InsertItem(shell);
+ Master.AffiliationArea.InsertItem(shellInstance);
}
- return shell;
+ return shellInstance;
}
///
/// 发射子弹
///
- protected IBullet ShootBullet(float fireRotation, string bulletId)
+ protected IBullet ShootBullet(float fireRotation, ExcelConfig.BulletBase bullet)
{
- var baseData = ExcelConfig.BulletBase_Map[bulletId];
- if (baseData.Type == 1) //实体子弹
+ if (bullet.Type == 1) //实体子弹
{
- return ShootSolidBullet(fireRotation, baseData.Prefab);
+ return ShootSolidBullet(fireRotation, bullet);
}
- else if (baseData.Type == 2) //激光子弹
+ else if (bullet.Type == 2) //激光子弹
{
- return ShootLaser(fireRotation, baseData.Prefab);
+ return ShootLaser(fireRotation, bullet);
}
return null;
}
///
- /// 发射子弹的默认实现方式, bulletId为子弹id
+ /// 发射子弹的默认实现方式
///
- private Bullet ShootSolidBullet(float fireRotation, string solidBulletId)
+ private Bullet ShootSolidBullet(float fireRotation, ExcelConfig.BulletBase bullet)
{
- var speed = Utils.Random.RandomConfigRange(Attribute.BulletSpeedRange);
- var distance = Utils.Random.RandomConfigRange(Attribute.BulletDistanceRange);
- var deviationAngle = Utils.Random.RandomConfigRange(Attribute.BulletDeviationAngleRange);
- if (Master != null)
+ var speed = Utils.Random.RandomConfigRange(bullet.SpeedRange);
+ var distance = Utils.Random.RandomConfigRange(bullet.DistanceRange);
+ var deviationAngle = Utils.Random.RandomConfigRange(bullet.DeviationAngleRange);
+ if (TriggerRole != null)
{
- speed = Master.RoleState.CallCalcBulletSpeedEvent(this, speed);
- distance = Master.RoleState.CallCalcBulletDistanceEvent(this, distance);
- deviationAngle = Master.RoleState.CallCalcBulletDeviationAngleEvent(this, deviationAngle);
+ speed = TriggerRole.RoleState.CallCalcBulletSpeedEvent(this, speed);
+ distance = TriggerRole.RoleState.CallCalcBulletDistanceEvent(this, distance);
+ deviationAngle = TriggerRole.RoleState.CallCalcBulletDeviationAngleEvent(this, deviationAngle);
}
-
- var attackLayer = GetAttackLayer();
+
//创建子弹
- var bullet = Create(solidBulletId);
- bullet.Init(
+ var bulletInstance = Create(bullet.Prefab);
+ bulletInstance.Init(
this,
speed,
distance,
FirePoint.GlobalPosition,
fireRotation + Mathf.DegToRad(deviationAngle),
- attackLayer
+ GetAttackLayer()
);
- bullet.MinHarm = Utils.GetConfigRangeStart(Attribute.HarmRange);
- bullet.MaxHarm = Utils.GetConfigRangeEnd(Attribute.HarmRange);
- return bullet;
+ bulletInstance.MinHarm = Utils.GetConfigRangeStart(Attribute.Bullet.HarmRange);
+ bulletInstance.MaxHarm = Utils.GetConfigRangeEnd(Attribute.Bullet.HarmRange);
+ return bulletInstance;
}
///
/// 发射射线的默认实现方式
///
- private Laser ShootLaser(float fireRotation, string prefab)
+ private Laser ShootLaser(float fireRotation, ExcelConfig.BulletBase bullet)
{
- var laser = ResourceManager.LoadAndInstantiate(prefab);
+ var laser = ResourceManager.LoadAndInstantiate(bullet.Prefab);
laser.AddToActivityRoot(RoomLayerEnum.YSortLayer);
- var deviationAngle = Utils.Random.RandomConfigRange(Attribute.BulletDeviationAngleRange);
+ var deviationAngle = Utils.Random.RandomConfigRange(Attribute.Bullet.DeviationAngleRange);
if (Master != null)
{
deviationAngle = Master.RoleState.CallCalcBulletDeviationAngleEvent(this, deviationAngle);
@@ -2000,8 +1991,8 @@
3,
600
);
- laser.MinHarm = Utils.GetConfigRangeStart(Attribute.HarmRange);
- laser.MaxHarm = Utils.GetConfigRangeEnd(Attribute.HarmRange);
+ laser.MinHarm = Utils.GetConfigRangeStart(Attribute.Bullet.HarmRange);
+ laser.MaxHarm = Utils.GetConfigRangeEnd(Attribute.Bullet.HarmRange);
return laser;
}
diff --git a/DungeonShooting_Godot/src/game/activity/weapon/gun/Gun.cs b/DungeonShooting_Godot/src/game/activity/weapon/gun/Gun.cs
index cd51aba..92a4cfe 100644
--- a/DungeonShooting_Godot/src/game/activity/weapon/gun/Gun.cs
+++ b/DungeonShooting_Godot/src/game/activity/weapon/gun/Gun.cs
@@ -29,7 +29,7 @@
protected override void OnShoot(float fireRotation)
{
- ShootBullet(fireRotation, Attribute.BulletId);
+ ShootBullet(fireRotation, Attribute.Bullet);
}
// //测试用, 敌人被消灭时触发手上武器开火
diff --git a/DungeonShooting_Godot/src/game/activity/weapon/knife/Knife.cs b/DungeonShooting_Godot/src/game/activity/weapon/knife/Knife.cs
index 3f74a4d..a8c3dff 100644
--- a/DungeonShooting_Godot/src/game/activity/weapon/knife/Knife.cs
+++ b/DungeonShooting_Godot/src/game/activity/weapon/knife/Knife.cs
@@ -129,13 +129,13 @@
{
if (activityObject is Role role) //碰到角色
{
- var damage = Utils.Random.RandomConfigRange(Attribute.HarmRange);
+ var damage = Utils.Random.RandomConfigRange(Attribute.Bullet.HarmRange);
damage = Master.RoleState.CallCalcDamageEvent(damage);
//击退
if (role is not Player) //目标不是玩家才会触发击退
{
var attr = Master.IsAi ? AiUseAttribute : PlayerUseAttribute;
- var repel = Utils.Random.RandomConfigRange(attr.RepelRnage);
+ var repel = Utils.Random.RandomConfigRange(attr.Bullet.RepelRnage);
if (repel != 0)
{
var position = role.GlobalPosition - Master.MountPoint.GlobalPosition;
diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorCreateMark/MarkObjectCell.cs b/DungeonShooting_Godot/src/game/ui/mapEditorCreateMark/MarkObjectCell.cs
index a25dbc5..b42ac54 100644
--- a/DungeonShooting_Godot/src/game/ui/mapEditorCreateMark/MarkObjectCell.cs
+++ b/DungeonShooting_Godot/src/game/ui/mapEditorCreateMark/MarkObjectCell.cs
@@ -218,7 +218,7 @@
numberBar.L_NumInput.Instance.MinValue = 0;
numberBar2.L_NumInput.Instance.MinValue = 0;
//武器配置数据
- var weapon = ExcelConfig.WeaponBase_List.Find(weapon => weapon.ActivityId == activityObject.Id);
+ var weapon = Weapon.GetWeaponAttribute(activityObject.Id);
if (weapon != null)
{
numberBar.L_NumInput.Instance.MaxValue = weapon.AmmoCapacity; //弹夹上限
@@ -276,7 +276,7 @@
}
if (markInfoItem.Attr.TryGetValue("Weapon", out var weaponId)) //武器
{
- weaponBar.Instance.SelectWeapon(ExcelConfig.WeaponBase_List.Find(w => w.ActivityId == weaponId));
+ weaponBar.Instance.SelectWeapon(Weapon.GetWeaponAttribute(weaponId));
}
if (markInfoItem.Attr.TryGetValue("CurrAmmon", out var currAmmon)) //弹夹弹药量
{
diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorCreateMark/attribute/ObjectAttribute.cs b/DungeonShooting_Godot/src/game/ui/mapEditorCreateMark/attribute/ObjectAttribute.cs
index 7bc3343..b3d23ae 100644
--- a/DungeonShooting_Godot/src/game/ui/mapEditorCreateMark/attribute/ObjectAttribute.cs
+++ b/DungeonShooting_Godot/src/game/ui/mapEditorCreateMark/attribute/ObjectAttribute.cs
@@ -33,7 +33,7 @@
{
return null;
}
- return _selectWeapon.ActivityId;
+ return _selectWeapon.Activity.Id;
}
//点击编辑按钮
@@ -50,7 +50,7 @@
private void OnSelectObject(ExcelConfig.ActivityBase activityObject)
{
- var weapon = ExcelConfig.WeaponBase_List.Find(weapon => weapon.ActivityId == activityObject.Id);
+ var weapon = Weapon.GetWeaponAttribute(activityObject.Id);
if (weapon != null)
{
SelectWeapon(weapon);
@@ -76,7 +76,7 @@
{
_objectBar.L_HBoxContainer.L_DeleteButton.Instance.Visible = true;
_selectWeapon = weapon;
- var o = ExcelConfig.ActivityBase_Map[weapon.ActivityId];
+ var o = weapon.Activity;
//显示关联属性
_currAmmonAttr.Instance.Visible = true;
_residueAmmoAttr.Instance.Visible = true;