diff --git a/DungeonShooting_Godot/excel/excelFile/ActivityBase.xlsx b/DungeonShooting_Godot/excel/excelFile/ActivityBase.xlsx
index 3237a19..bd6a11a 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
index 6dfb2a3..e5d3df5 100644
--- a/DungeonShooting_Godot/excel/excelFile/ActivityMaterial.xlsx
+++ 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 6652550..424da67 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 4dc62af..afd438c 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 3db3a42..6bd1742 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 44a0031..88e9e65 100644
--- a/DungeonShooting_Godot/excel/excelFile/WeaponBase.xlsx
+++ b/DungeonShooting_Godot/excel/excelFile/WeaponBase.xlsx
Binary files differ
diff --git a/DungeonShooting_Godot/prefab/role/Enemy0002.tscn b/DungeonShooting_Godot/prefab/role/Enemy0002.tscn
index 6c5aa16..3fe20e2 100644
--- a/DungeonShooting_Godot/prefab/role/Enemy0002.tscn
+++ b/DungeonShooting_Godot/prefab/role/Enemy0002.tscn
@@ -1,4 +1,4 @@
-[gd_scene load_steps=7 format=3 uid="uid://b5r3hd8kv2wmd"]
+[gd_scene load_steps=10 format=3 uid="uid://b5r3hd8kv2wmd"]
[ext_resource type="PackedScene" uid="uid://dxeqcssparqoo" path="res://prefab/role/template/EnemyTemplate.tscn" id="1_rikvp"]
[ext_resource type="Script" path="res://src/game/activity/role/enemy/Enemy.cs" id="2_wjtfl"]
@@ -27,12 +27,88 @@
shader_parameter/outline_rainbow = false
shader_parameter/outline_use_blend = true
-[node name="Enemy0002" node_paths=PackedStringArray("ViewRay", "NavigationAgent2D", "NavigationPoint", "FirePoint", "HurtArea", "HurtCollision", "InteractiveArea", "InteractiveCollision", "ShadowSprite", "AnimatedSprite", "Collision") instance=ExtResource("1_rikvp")]
+[sub_resource type="Animation" id="Animation_wn6ao"]
+resource_name = "attack"
+length = 0.6
+tracks/0/type = "value"
+tracks/0/imported = false
+tracks/0/enabled = true
+tracks/0/path = NodePath("AnimatedSprite:animation")
+tracks/0/interp = 1
+tracks/0/loop_wrap = true
+tracks/0/keys = {
+"times": PackedFloat32Array(0, 0.6),
+"transitions": PackedFloat32Array(1, 1),
+"update": 1,
+"values": [&"attack", &"idle"]
+}
+tracks/1/type = "value"
+tracks/1/imported = false
+tracks/1/enabled = true
+tracks/1/path = NodePath("AnimatedSprite:frame")
+tracks/1/interp = 1
+tracks/1/loop_wrap = true
+tracks/1/keys = {
+"times": PackedFloat32Array(0, 0.5),
+"transitions": PackedFloat32Array(1, 1),
+"update": 0,
+"values": [0, 7]
+}
+tracks/2/type = "method"
+tracks/2/imported = false
+tracks/2/enabled = true
+tracks/2/path = NodePath(".")
+tracks/2/interp = 1
+tracks/2/loop_wrap = true
+tracks/2/keys = {
+"times": PackedFloat32Array(0.3),
+"transitions": PackedFloat32Array(1),
+"values": [{
+"args": [],
+"method": &"ShootBullet"
+}]
+}
+
+[sub_resource type="Animation" id="Animation_0iqth"]
+length = 0.001
+tracks/0/type = "value"
+tracks/0/imported = false
+tracks/0/enabled = true
+tracks/0/path = NodePath("AnimatedSprite:animation")
+tracks/0/interp = 1
+tracks/0/loop_wrap = true
+tracks/0/keys = {
+"times": PackedFloat32Array(0),
+"transitions": PackedFloat32Array(1),
+"update": 1,
+"values": [&"attack"]
+}
+tracks/1/type = "value"
+tracks/1/imported = false
+tracks/1/enabled = true
+tracks/1/path = NodePath("AnimatedSprite:frame")
+tracks/1/interp = 1
+tracks/1/loop_wrap = true
+tracks/1/keys = {
+"times": PackedFloat32Array(0),
+"transitions": PackedFloat32Array(1),
+"update": 1,
+"values": [5]
+}
+
+[sub_resource type="AnimationLibrary" id="AnimationLibrary_wxs4x"]
+_data = {
+"RESET": SubResource("Animation_0iqth"),
+"attack": SubResource("Animation_wn6ao")
+}
+
+[node name="Enemy0002" node_paths=PackedStringArray("ViewRay", "NavigationAgent2D", "NavigationPoint", "FirePoint", "AnimationPlayer", "HurtArea", "HurtCollision", "InteractiveArea", "InteractiveCollision", "ShadowSprite", "AnimatedSprite", "Collision") instance=ExtResource("1_rikvp")]
script = ExtResource("2_wjtfl")
ViewRay = NodePath("ViewRay")
NavigationAgent2D = NodePath("NavigationPoint/NavigationAgent2D")
NavigationPoint = NodePath("NavigationPoint")
FirePoint = NodePath("AnimatedSprite/FirePoint")
+AnimationPlayer = NodePath("AnimationPlayer")
HurtArea = NodePath("HurtArea")
HurtCollision = NodePath("HurtArea/HurtCollision")
InteractiveArea = NodePath("InteractiveArea")
@@ -48,6 +124,13 @@
material = SubResource("ShaderMaterial_ntjmx")
position = Vector2(0, -10)
sprite_frames = ExtResource("4_ehtyi")
+animation = &"attack"
+frame = 5
[node name="FirePoint" type="Marker2D" parent="AnimatedSprite" index="0"]
position = Vector2(9, 4)
+
+[node name="AnimationPlayer" type="AnimationPlayer" parent="." index="7"]
+libraries = {
+"": SubResource("AnimationLibrary_wxs4x")
+}
diff --git a/DungeonShooting_Godot/project.godot b/DungeonShooting_Godot/project.godot
index 2cd411b..5da264c 100644
--- a/DungeonShooting_Godot/project.godot
+++ b/DungeonShooting_Godot/project.godot
@@ -182,6 +182,11 @@
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":88,"key_label":0,"unicode":120,"echo":false,"script":null)
]
}
+exchangeProp={
+"deadzone": 0.5,
+"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":90,"key_label":0,"unicode":122,"echo":false,"script":null)
+]
+}
[layer_names]
diff --git a/DungeonShooting_Godot/resource/config/ActivityBase.json b/DungeonShooting_Godot/resource/config/ActivityBase.json
index 4f95e68..d5a76c2 100644
--- a/DungeonShooting_Godot/resource/config/ActivityBase.json
+++ b/DungeonShooting_Godot/resource/config/ActivityBase.json
@@ -186,7 +186,7 @@
"Intro": "",
"Details": "",
"IsStatic": false,
- "__Material": "0002",
+ "__Material": "0005",
"Prefab": "res://prefab/bullet/normal/Bullet0004.tscn",
"Icon": "",
"ShowInMapEditor": false
diff --git a/DungeonShooting_Godot/resource/config/ActivityMaterial.json b/DungeonShooting_Godot/resource/config/ActivityMaterial.json
index 505d7ec..b2c717b 100644
--- a/DungeonShooting_Godot/resource/config/ActivityMaterial.json
+++ b/DungeonShooting_Godot/resource/config/ActivityMaterial.json
@@ -54,5 +54,19 @@
"FallBounceSpeed": 0.75,
"FallBounceRotation": 0.5,
"DynamicCollision": true
+ },
+ {
+ "Id": "0005",
+ "Remark": "\u7403\u4F53\u5B50\u5F39\uFF0C\u6469\u64E6\u529B\u8F83\u4F4E",
+ "Friction": 40,
+ "GravityScale": 1,
+ "RotationType": 1,
+ "RotationFriction": 40,
+ "Bounce": true,
+ "BounceStrength": 0.7,
+ "FallBounceStrength": 0.7,
+ "FallBounceSpeed": 0.85,
+ "FallBounceRotation": 0.85,
+ "DynamicCollision": false
}
]
\ No newline at end of file
diff --git a/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/inlet/Start1/Preview.png b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/inlet/Start1/Preview.png
index d64d95a..e7bb706 100644
--- a/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/inlet/Start1/Preview.png
+++ b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/inlet/Start1/Preview.png
Binary files differ
diff --git a/DungeonShooting_Godot/resource/sprite/role/enemy0002/Enemy0002_attack.png b/DungeonShooting_Godot/resource/sprite/role/enemy0002/Enemy0002_attack.png
new file mode 100644
index 0000000..30c95c6
--- /dev/null
+++ b/DungeonShooting_Godot/resource/sprite/role/enemy0002/Enemy0002_attack.png
Binary files differ
diff --git a/DungeonShooting_Godot/resource/sprite/role/enemy0002/Enemy0002_attack.png.import b/DungeonShooting_Godot/resource/sprite/role/enemy0002/Enemy0002_attack.png.import
new file mode 100644
index 0000000..5342ed6
--- /dev/null
+++ b/DungeonShooting_Godot/resource/sprite/role/enemy0002/Enemy0002_attack.png.import
@@ -0,0 +1,34 @@
+[remap]
+
+importer="texture"
+type="CompressedTexture2D"
+uid="uid://byvhnaggvvfex"
+path="res://.godot/imported/Enemy0002_attack.png-f20e305d5da437157c0eadd45ddd9904.ctex"
+metadata={
+"vram_texture": false
+}
+
+[deps]
+
+source_file="res://resource/sprite/role/enemy0002/Enemy0002_attack.png"
+dest_files=["res://.godot/imported/Enemy0002_attack.png-f20e305d5da437157c0eadd45ddd9904.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/sprite/role/enemy0002/Enemy0002_dead.png b/DungeonShooting_Godot/resource/sprite/role/enemy0002/Enemy0002_dead.png
new file mode 100644
index 0000000..80665e9
--- /dev/null
+++ b/DungeonShooting_Godot/resource/sprite/role/enemy0002/Enemy0002_dead.png
Binary files differ
diff --git a/DungeonShooting_Godot/resource/sprite/role/enemy0002/Enemy0002_dead.png.import b/DungeonShooting_Godot/resource/sprite/role/enemy0002/Enemy0002_dead.png.import
new file mode 100644
index 0000000..1c26740
--- /dev/null
+++ b/DungeonShooting_Godot/resource/sprite/role/enemy0002/Enemy0002_dead.png.import
@@ -0,0 +1,34 @@
+[remap]
+
+importer="texture"
+type="CompressedTexture2D"
+uid="uid://x3tjqgdgp43n"
+path="res://.godot/imported/Enemy0002_dead.png-9318cf73f87fed753124e3e669c47c34.ctex"
+metadata={
+"vram_texture": false
+}
+
+[deps]
+
+source_file="res://resource/sprite/role/enemy0002/Enemy0002_dead.png"
+dest_files=["res://.godot/imported/Enemy0002_dead.png-9318cf73f87fed753124e3e669c47c34.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/role/Enemy0002.tres b/DungeonShooting_Godot/resource/spriteFrames/role/Enemy0002.tres
index 227127a..2851e22 100644
--- a/DungeonShooting_Godot/resource/spriteFrames/role/Enemy0002.tres
+++ b/DungeonShooting_Godot/resource/spriteFrames/role/Enemy0002.tres
@@ -1,9 +1,42 @@
-[gd_resource type="SpriteFrames" load_steps=19 format=3 uid="uid://ctpkpxgcwb583"]
+[gd_resource type="SpriteFrames" load_steps=28 format=3 uid="uid://ctpkpxgcwb583"]
[ext_resource type="Texture2D" uid="uid://ba6ke6xp63lnv" path="res://resource/sprite/role/enemy0002/Enemy0002.png" id="1_bvqwm"]
+[ext_resource type="Texture2D" uid="uid://byvhnaggvvfex" path="res://resource/sprite/role/enemy0002/Enemy0002_attack.png" id="1_ery1t"]
[ext_resource type="Texture2D" uid="uid://bwafpoxpkx3lu" path="res://resource/sprite/role/enemy0002/Enemy0002_idle.png" id="2_755ta"]
[ext_resource type="Texture2D" uid="uid://dibftt2rj5omq" path="res://resource/sprite/role/enemy0002/Enemy0002_run.png" id="3_xwtnk"]
+[sub_resource type="AtlasTexture" id="AtlasTexture_dndp7"]
+atlas = ExtResource("1_ery1t")
+region = Rect2(0, 0, 32, 32)
+
+[sub_resource type="AtlasTexture" id="AtlasTexture_vs2pd"]
+atlas = ExtResource("1_ery1t")
+region = Rect2(32, 0, 32, 32)
+
+[sub_resource type="AtlasTexture" id="AtlasTexture_0k6qn"]
+atlas = ExtResource("1_ery1t")
+region = Rect2(64, 0, 32, 32)
+
+[sub_resource type="AtlasTexture" id="AtlasTexture_h5xlr"]
+atlas = ExtResource("1_ery1t")
+region = Rect2(96, 0, 32, 32)
+
+[sub_resource type="AtlasTexture" id="AtlasTexture_djcbg"]
+atlas = ExtResource("1_ery1t")
+region = Rect2(128, 0, 32, 32)
+
+[sub_resource type="AtlasTexture" id="AtlasTexture_10of8"]
+atlas = ExtResource("1_ery1t")
+region = Rect2(160, 0, 32, 32)
+
+[sub_resource type="AtlasTexture" id="AtlasTexture_5cxnc"]
+atlas = ExtResource("1_ery1t")
+region = Rect2(192, 0, 32, 32)
+
+[sub_resource type="AtlasTexture" id="AtlasTexture_3f3fu"]
+atlas = ExtResource("1_ery1t")
+region = Rect2(224, 0, 32, 32)
+
[sub_resource type="AtlasTexture" id="AtlasTexture_pbkbq"]
atlas = ExtResource("2_755ta")
region = Rect2(32, 0, 32, 32)
@@ -68,6 +101,35 @@
animations = [{
"frames": [{
"duration": 1.0,
+"texture": SubResource("AtlasTexture_dndp7")
+}, {
+"duration": 1.0,
+"texture": SubResource("AtlasTexture_vs2pd")
+}, {
+"duration": 1.0,
+"texture": SubResource("AtlasTexture_0k6qn")
+}, {
+"duration": 1.0,
+"texture": SubResource("AtlasTexture_h5xlr")
+}, {
+"duration": 1.0,
+"texture": SubResource("AtlasTexture_djcbg")
+}, {
+"duration": 1.0,
+"texture": SubResource("AtlasTexture_10of8")
+}, {
+"duration": 1.0,
+"texture": SubResource("AtlasTexture_5cxnc")
+}, {
+"duration": 1.0,
+"texture": SubResource("AtlasTexture_3f3fu")
+}],
+"loop": false,
+"name": &"attack",
+"speed": 8.0
+}, {
+"frames": [{
+"duration": 1.0,
"texture": ExtResource("1_bvqwm")
}],
"loop": true,
@@ -98,7 +160,7 @@
}],
"loop": true,
"name": &"idle",
-"speed": 7.0
+"speed": 8.0
}, {
"frames": [{
"duration": 1.0,
diff --git a/DungeonShooting_Godot/src/game/AnimatorNames.cs b/DungeonShooting_Godot/src/game/AnimatorNames.cs
index b393c9f..6714285 100644
--- a/DungeonShooting_Godot/src/game/AnimatorNames.cs
+++ b/DungeonShooting_Godot/src/game/AnimatorNames.cs
@@ -1,4 +1,6 @@
+using Godot;
+
///
/// 预制动画名称
///
@@ -68,4 +70,8 @@
/// 物体移动
///
public const string Move = "move";
+ ///
+ /// 攻击
+ ///
+ public const string Attack = "attack";
}
\ No newline at end of file
diff --git a/DungeonShooting_Godot/src/game/activity/prop/Prop.cs b/DungeonShooting_Godot/src/game/activity/prop/Prop.cs
index beb1751..09ddfca 100644
--- a/DungeonShooting_Godot/src/game/activity/prop/Prop.cs
+++ b/DungeonShooting_Godot/src/game/activity/prop/Prop.cs
@@ -47,7 +47,7 @@
//阴影偏移
ShadowOffset = new Vector2(0, 2);
GlobalRotation = 0;
- var startHeight = -master.GetCenterPosition().Y;
+ var startHeight = 8;
Throw(startPosition, startHeight, 0, Vector2.Zero, 0);
//继承role的移动速度
diff --git a/DungeonShooting_Godot/src/game/activity/role/enemy/Enemy.cs b/DungeonShooting_Godot/src/game/activity/role/enemy/Enemy.cs
index ca49323..7265228 100644
--- a/DungeonShooting_Godot/src/game/activity/role/enemy/Enemy.cs
+++ b/DungeonShooting_Godot/src/game/activity/role/enemy/Enemy.cs
@@ -142,13 +142,10 @@
public virtual void EnemyAttack()
{
Debug.Log("触发攻击");
- FireManager.ShootBullet(this, ConvertRotation(Position.AngleTo(LookPosition)), ExcelConfig.BulletBase_Map["0006"]);
- // for (int i = 0; i < 100; i++)
- // {
- // FireManager.ShootBullet(this, ConvertRotation(Mathf.DegToRad(i * 3.6f)), ExcelConfig.BulletBase_List[0]);
- // }
+ var bulletData = FireManager.GetBulletData(this, ConvertRotation(Position.AngleTo(LookPosition)), ExcelConfig.BulletBase_Map["0006"]);
+ FireManager.ShootBullet(bulletData, AttackLayer);
}
-
+
protected override void Process(float delta)
{
base.Process(delta);
diff --git a/DungeonShooting_Godot/src/game/activity/role/enemy/normalState/AiFollowUpState.cs b/DungeonShooting_Godot/src/game/activity/role/enemy/normalState/AiFollowUpState.cs
index 35c2caa..c4ec235 100644
--- a/DungeonShooting_Godot/src/game/activity/role/enemy/normalState/AiFollowUpState.cs
+++ b/DungeonShooting_Godot/src/game/activity/role/enemy/normalState/AiFollowUpState.cs
@@ -85,6 +85,7 @@
if (inAttackRange) //在攻击范围内
{
//发起攻击
+ //Master.AnimatedSprite.Play(AnimatorNames.Attack);
Master.Attack();
//距离够近, 可以切换到环绕模式
diff --git a/DungeonShooting_Godot/src/game/manager/FireManager.cs b/DungeonShooting_Godot/src/game/manager/FireManager.cs
index 1615c75..727edf2 100644
--- a/DungeonShooting_Godot/src/game/manager/FireManager.cs
+++ b/DungeonShooting_Godot/src/game/manager/FireManager.cs
@@ -45,17 +45,51 @@
}
///
+ /// 根据武器创建 BulletData
+ ///
+ public static BulletData GetBulletData(Weapon weapon, float fireRotation, ExcelConfig.BulletBase bullet)
+ {
+ if (bullet.Type == 1) //实体子弹
+ {
+ return CreateSolidBulletData(weapon, fireRotation, bullet);
+ }
+ else if (bullet.Type == 2) //激光子弹
+ {
+ return CreateLaserData(weapon, fireRotation, bullet);
+ }
+ else
+ {
+ Debug.LogError("暂未支持的子弹类型: " + bullet.Type);
+ }
+
+ return null;
+ }
+
+ ///
+ /// 根据角色创建 BulletData
+ ///
+ public static BulletData GetBulletData(Role trigger, float fireRotation, ExcelConfig.BulletBase bullet)
+ {
+ if (bullet.Type == 1) //实体子弹
+ {
+ return CreateSolidBulletData(trigger, fireRotation, bullet);
+ }
+
+ return null;
+ }
+
+ ///
/// 通过武器发射子弹
///
public static IBullet ShootBullet(Weapon weapon, float fireRotation, ExcelConfig.BulletBase bullet)
{
if (bullet.Type == 1) //实体子弹
{
- return ShootSolidBullet(weapon, fireRotation, bullet);
+ return ShootSolidBullet(CreateSolidBulletData(weapon, fireRotation, bullet), weapon.GetAttackLayer());
}
else if (bullet.Type == 2) //激光子弹
{
- return ShootLaser(weapon, fireRotation, bullet);
+ return ShootLaser(CreateLaserData(weapon, fireRotation, bullet), weapon.GetAttackLayer());
}
else
{
@@ -72,7 +106,28 @@
{
if (bullet.Type == 1) //实体子弹
{
- return ShootSolidBullet(trigger, fireRotation, bullet);
+ return ShootSolidBullet(CreateSolidBulletData(trigger, fireRotation, bullet), trigger.AttackLayer);
+ }
+
+ return null;
+ }
+
+ ///
+ /// 通过 BulletData 直接发射子弹
+ ///
+ public static IBullet ShootBullet(BulletData bulletData, uint attackLayer)
+ {
+ if (bulletData.BulletBase.Type == 1) //实体子弹
+ {
+ return ShootSolidBullet(bulletData, attackLayer);
+ }
+ else if (bulletData.BulletBase.Type == 2) //激光子弹
+ {
+ return ShootLaser(bulletData, attackLayer);
+ }
+ else
+ {
+ Debug.LogError("暂未支持的子弹类型: " + bulletData.BulletBase.Type);
}
return null;
@@ -81,7 +136,29 @@
///
/// 发射子弹的默认实现方式
///
- private static Bullet ShootSolidBullet(Weapon weapon, float fireRotation, ExcelConfig.BulletBase bullet)
+ private static Bullet ShootSolidBullet(BulletData bulletData, uint attackLayer)
+ {
+ //创建子弹
+ var bulletInstance = ObjectManager.GetBullet(bulletData.BulletBase.Prefab);
+ bulletInstance.InitData(bulletData, attackLayer);
+ return bulletInstance;
+ }
+
+ ///
+ /// 发射射线的默认实现方式
+ ///
+ private static Laser ShootLaser(BulletData bulletData, uint attackLayer)
+ {
+ //创建激光
+ var laser = ObjectManager.GetLaser(bulletData.BulletBase.Prefab);
+ laser.AddToActivityRoot(RoomLayerEnum.YSortLayer);
+ laser.InitData(bulletData, attackLayer, 3);
+ return laser;
+ }
+
+ //-----------------------------------------------------------------------------------
+
+ private static BulletData CreateSolidBulletData(Weapon weapon, float fireRotation, ExcelConfig.BulletBase bullet)
{
var data = new BulletData()
{
@@ -122,59 +199,10 @@
}
data.Rotation = fireRotation + Mathf.DegToRad(deviationAngle);
- //创建子弹
- var bulletInstance = ObjectManager.GetBullet(bullet.Prefab);
- bulletInstance.InitData(data, weapon.GetAttackLayer());
- return bulletInstance;
- }
-
- ///
- /// 发射射线的默认实现方式
- ///
- private static Laser ShootLaser(Weapon weapon, float fireRotation, ExcelConfig.BulletBase bullet)
- {
- var data = new BulletData()
- {
- Weapon = weapon,
- BulletBase = bullet,
- TriggerRole = weapon.TriggerRole,
- Harm = Utils.Random.RandomConfigRange(bullet.HarmRange),
- Repel = Utils.Random.RandomConfigRange(bullet.RepelRange),
- MaxDistance = Utils.Random.RandomConfigRange(bullet.DistanceRange),
- BounceCount = Utils.Random.RandomConfigRange(bullet.BounceCount),
- LifeTime = Utils.Random.RandomConfigRange(bullet.LifeTimeRange),
- Position = weapon.FirePoint.GlobalPosition,
- };
-
- var deviationAngle = Utils.Random.RandomConfigRange(bullet.DeviationAngleRange);
- if (weapon.TriggerRole != null)
- {
- data.Altitude = weapon.TriggerRole.GetFirePointAltitude();
- var roleState = weapon.TriggerRole.RoleState;
- data.Harm = roleState.CalcDamage(data.Harm);
- data.Repel = roleState.CalcBulletRepel(data.Repel);
- data.BounceCount = roleState.CalcBulletBounceCount(data.BounceCount);
- deviationAngle = roleState.CalcBulletDeviationAngle(deviationAngle);
- }
- else
- {
- data.Altitude = 1;
- }
-
- data.Rotation = fireRotation + Mathf.DegToRad(deviationAngle);
- //创建激光
- var laser = ObjectManager.GetLaser(bullet.Prefab);
- laser.AddToActivityRoot(RoomLayerEnum.YSortLayer);
- laser.InitData(data, weapon.GetAttackLayer(), 3);
- return laser;
+ return data;
}
- //-----------------------------------------------------------------------------------
-
- ///
- /// 发射子弹的默认实现方式
- ///
- private static Bullet ShootSolidBullet(Role role, float fireRotation, ExcelConfig.BulletBase bullet)
+ private static BulletData CreateSolidBulletData(Role role, float fireRotation, ExcelConfig.BulletBase bullet)
{
var data = new BulletData()
{
@@ -220,10 +248,40 @@
// }
data.Rotation = fireRotation + Mathf.DegToRad(deviationAngle);
- //创建子弹
- var bulletInstance = ObjectManager.GetBullet(bullet.Prefab);
- bulletInstance.InitData(data, role.AttackLayer);
- return bulletInstance;
+ return data;
}
-
+
+ private static BulletData CreateLaserData(Weapon weapon, float fireRotation, ExcelConfig.BulletBase bullet)
+ {
+ var data = new BulletData()
+ {
+ Weapon = weapon,
+ BulletBase = bullet,
+ TriggerRole = weapon.TriggerRole,
+ Harm = Utils.Random.RandomConfigRange(bullet.HarmRange),
+ Repel = Utils.Random.RandomConfigRange(bullet.RepelRange),
+ MaxDistance = Utils.Random.RandomConfigRange(bullet.DistanceRange),
+ BounceCount = Utils.Random.RandomConfigRange(bullet.BounceCount),
+ LifeTime = Utils.Random.RandomConfigRange(bullet.LifeTimeRange),
+ Position = weapon.FirePoint.GlobalPosition,
+ };
+
+ var deviationAngle = Utils.Random.RandomConfigRange(bullet.DeviationAngleRange);
+ if (weapon.TriggerRole != null)
+ {
+ data.Altitude = weapon.TriggerRole.GetFirePointAltitude();
+ var roleState = weapon.TriggerRole.RoleState;
+ data.Harm = roleState.CalcDamage(data.Harm);
+ data.Repel = roleState.CalcBulletRepel(data.Repel);
+ data.BounceCount = roleState.CalcBulletBounceCount(data.BounceCount);
+ deviationAngle = roleState.CalcBulletDeviationAngle(deviationAngle);
+ }
+ else
+ {
+ data.Altitude = 1;
+ }
+
+ data.Rotation = fireRotation + Mathf.DegToRad(deviationAngle);
+ return data;
+ }
}
\ No newline at end of file
diff --git a/DungeonShooting_Godot/src/game/manager/InputManager.cs b/DungeonShooting_Godot/src/game/manager/InputManager.cs
index 7aaab2d..f143b97 100644
--- a/DungeonShooting_Godot/src/game/manager/InputManager.cs
+++ b/DungeonShooting_Godot/src/game/manager/InputManager.cs
@@ -97,5 +97,6 @@
Roll = Input.IsActionJustPressed("roll");
UseActiveProp = Input.IsActionJustPressed("useActiveProp");
RemoveProp = Input.IsActionJustPressed("removeProp");
+ ExchangeProp = Input.IsActionJustPressed("exchangeProp");
}
}
\ No newline at end of file