diff --git a/DungeonShooting_Godot/excel/excelFile/ActivityObject.xlsx b/DungeonShooting_Godot/excel/excelFile/ActivityObject.xlsx
index 1e87def..ef7e9d0 100644
--- a/DungeonShooting_Godot/excel/excelFile/ActivityObject.xlsx
+++ b/DungeonShooting_Godot/excel/excelFile/ActivityObject.xlsx
Binary files differ
diff --git a/DungeonShooting_Godot/excel/excelFile/Sound.xlsx b/DungeonShooting_Godot/excel/excelFile/Sound.xlsx
index 85c2bfe..e0dc11d 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/Weapon.xlsx b/DungeonShooting_Godot/excel/excelFile/Weapon.xlsx
index 0438bd3..602ddbe 100644
--- a/DungeonShooting_Godot/excel/excelFile/Weapon.xlsx
+++ b/DungeonShooting_Godot/excel/excelFile/Weapon.xlsx
Binary files differ
diff --git a/DungeonShooting_Godot/resource/config/Weapon.json b/DungeonShooting_Godot/resource/config/Weapon.json
index de93e9d..086f1f4 100644
--- a/DungeonShooting_Godot/resource/config/Weapon.json
+++ b/DungeonShooting_Godot/resource/config/Weapon.json
@@ -43,6 +43,7 @@
"UpliftAngleRestore": 1,
"BulletId": "bullet0001",
"ShellId": "shell0001",
+ "ThrowShellDelayTime": 0,
"BulletMinDeviationAngle": 0,
"BulletMaxDeviationAngle": 0,
"BulletMaxSpeed": 350,
@@ -112,6 +113,7 @@
"UpliftAngleRestore": 1,
"BulletId": "bullet0001",
"ShellId": "shell0001",
+ "ThrowShellDelayTime": 0,
"BulletMinDeviationAngle": 0,
"BulletMaxDeviationAngle": 0,
"BulletMaxSpeed": 350,
@@ -181,6 +183,7 @@
"UpliftAngleRestore": 1,
"BulletId": "bullet0002",
"ShellId": "shell0002",
+ "ThrowShellDelayTime": 0.2,
"BulletMinDeviationAngle": -10,
"BulletMaxDeviationAngle": 10,
"BulletMaxSpeed": 280,
@@ -250,6 +253,7 @@
"UpliftAngleRestore": 1,
"BulletId": "bullet0002",
"ShellId": "shell0002",
+ "ThrowShellDelayTime": 0.2,
"BulletMinDeviationAngle": -10,
"BulletMaxDeviationAngle": 10,
"BulletMaxSpeed": 280,
@@ -319,6 +323,7 @@
"UpliftAngleRestore": 1,
"BulletId": "bullet0001",
"ShellId": "shell0001",
+ "ThrowShellDelayTime": 0,
"BulletMinDeviationAngle": 0,
"BulletMaxDeviationAngle": 0,
"BulletMaxSpeed": 350,
@@ -388,6 +393,7 @@
"UpliftAngleRestore": 1,
"BulletId": "bullet0001",
"ShellId": "shell0001",
+ "ThrowShellDelayTime": 0,
"BulletMinDeviationAngle": 0,
"BulletMaxDeviationAngle": 0,
"BulletMaxSpeed": 350,
@@ -457,6 +463,7 @@
"UpliftAngleRestore": 1,
"BulletId": "bullet0001",
"ShellId": "",
+ "ThrowShellDelayTime": 0,
"BulletMinDeviationAngle": 0,
"BulletMaxDeviationAngle": 0,
"BulletMaxSpeed": 350,
@@ -526,6 +533,7 @@
"UpliftAngleRestore": 1,
"BulletId": "bullet0001",
"ShellId": "",
+ "ThrowShellDelayTime": 0,
"BulletMinDeviationAngle": 0,
"BulletMaxDeviationAngle": 0,
"BulletMaxSpeed": 350,
@@ -562,7 +570,7 @@
"AmmoCapacity": 10,
"MaxAmmoCapacity": 50,
"StandbyAmmoCapacity": 40,
- "ReloadTime": 2.5,
+ "ReloadTime": 3,
"AloneReload": false,
"AloneReloadCount": 1,
"AloneReloadBeginIntervalTime": 0,
@@ -595,6 +603,7 @@
"UpliftAngleRestore": 1,
"BulletId": "bullet0001",
"ShellId": "shell0003",
+ "ThrowShellDelayTime": 0.2,
"BulletMinDeviationAngle": 0,
"BulletMaxDeviationAngle": 0,
"BulletMaxSpeed": 600,
@@ -607,7 +616,7 @@
},
"__ShootSound": "shooting0008",
"__BeginReloadSound": "reloadBegin0009",
- "BeginReloadSoundDelayTime": 0.3,
+ "BeginReloadSoundDelayTime": 0,
"__ReloadSound": "",
"ReloadSoundDelayTime": 0,
"__ReloadFinishSound": "beLoaded0007",
@@ -664,6 +673,7 @@
"UpliftAngleRestore": 1,
"BulletId": "bullet0002",
"ShellId": "shell0001",
+ "ThrowShellDelayTime": 0,
"BulletMinDeviationAngle": 0,
"BulletMaxDeviationAngle": 0,
"BulletMaxSpeed": 320,
diff --git a/DungeonShooting_Godot/resource/map/tileMaps/testGroup/inlet/Room1.tscn b/DungeonShooting_Godot/resource/map/tileMaps/testGroup/inlet/Room1.tscn
index 379a4bf..7c48b25 100644
--- a/DungeonShooting_Godot/resource/map/tileMaps/testGroup/inlet/Room1.tscn
+++ b/DungeonShooting_Godot/resource/map/tileMaps/testGroup/inlet/Room1.tscn
@@ -20,7 +20,7 @@
position = Vector2(129, 68)
script = ExtResource("3_m4jrh")
Type = 5
-ItemExpression = "0002(CurrAmmon:0)"
+ItemExpression = "0002"
WaveNumber = 2
[node name="ActivityMark5" type="Node2D" parent="."]
diff --git a/DungeonShooting_Godot/resource/sound/sfx/reloading/Reloading_begin0009.ogg b/DungeonShooting_Godot/resource/sound/sfx/reloading/Reloading_begin0009.ogg
index d089083..d8f33b0 100644
--- a/DungeonShooting_Godot/resource/sound/sfx/reloading/Reloading_begin0009.ogg
+++ b/DungeonShooting_Godot/resource/sound/sfx/reloading/Reloading_begin0009.ogg
Binary files differ
diff --git a/DungeonShooting_Godot/src/config/ExcelConfig_Weapon.cs b/DungeonShooting_Godot/src/config/ExcelConfig_Weapon.cs
index 6bdc8a2..624ada8 100644
--- a/DungeonShooting_Godot/src/config/ExcelConfig_Weapon.cs
+++ b/DungeonShooting_Godot/src/config/ExcelConfig_Weapon.cs
@@ -269,6 +269,13 @@
public string ShellId;
///
+ /// 投抛弹壳的延时时间, 在射击或者上膛后会触发抛弹壳效果
+ /// 如果为负数, 则不自动抛弹
+ ///
+ [JsonInclude]
+ public float ThrowShellDelayTime;
+
+ ///
/// 子弹最小偏移角度
/// 用于设置子弹偏移朝向, 该属性和射半径效果类似, 但与其不同的是, 散射半径是用来控制枪口朝向的, 而该属性是控制子弹朝向的, 可用于制作霰弹枪子弹效果
///
@@ -443,6 +450,7 @@
inst.UpliftAngleRestore = UpliftAngleRestore;
inst.BulletId = BulletId;
inst.ShellId = ShellId;
+ inst.ThrowShellDelayTime = ThrowShellDelayTime;
inst.BulletMinDeviationAngle = BulletMinDeviationAngle;
inst.BulletMaxDeviationAngle = BulletMaxDeviationAngle;
inst.BulletMaxSpeed = BulletMaxSpeed;
diff --git a/DungeonShooting_Godot/src/game/activity/weapon/Weapon.cs b/DungeonShooting_Godot/src/game/activity/weapon/Weapon.cs
index 38ce299..6d4d491 100644
--- a/DungeonShooting_Godot/src/game/activity/weapon/Weapon.cs
+++ b/DungeonShooting_Godot/src/game/activity/weapon/Weapon.cs
@@ -339,7 +339,6 @@
///
protected virtual void OnBeginReload()
{
-
}
///
@@ -664,9 +663,18 @@
if (_beLoadedState == 0 || _beLoadedState == -1) //需要执行上膛操作
{
- if (_attackTimer <= 0 && justDown)
+ if (justDown && !Reloading)
{
- BeLoadedHandler();
+ if (CurrAmmo <= 0)
+ {
+ //子弹不够, 触发换弹
+ Reload();
+ }
+ else if (_attackTimer <= 0)
+ {
+ //触发上膛操作
+ BeLoadedHandler();
+ }
}
}
else if (_beLoadedState == 1) //上膛中
@@ -900,6 +908,12 @@
//播放射击音效
PlayShootSound();
+ //抛弹
+ if (Attribute.ContinuousShoot && Attribute.ShellId != null)
+ {
+ ThrowShellHandler(1f);
+ }
+
//触发开火函数
OnFire();
@@ -1036,7 +1050,7 @@
///
public void Reload()
{
- if (CurrAmmo < Attribute.AmmoCapacity && ResidueAmmo > 0 && !Reloading)
+ if (CurrAmmo < Attribute.AmmoCapacity && ResidueAmmo > 0 && !Reloading && _beLoadedState != 1)
{
Reloading = true;
_playReloadFinishSoundFlag = false;
@@ -1045,6 +1059,12 @@
PlayBeginReloadSound();
// GD.Print("开始换弹.");
+ //抛弹
+ if (!Attribute.ContinuousShoot && (_beLoadedState == 0 || _beLoadedState == -1) && Attribute.BeLoadedTime > 0 && Attribute.ShellId != null)
+ {
+ ThrowShellHandler(0.6f);
+ }
+
//第一次换弹
OnBeginReload();
@@ -1147,8 +1167,13 @@
//等待执行自动上膛
_beLoadedState = -1;
}
+ else
+ {
+ //没子弹了, 需要手动上膛
+ _beLoadedState = 0;
+ }
}
- else if (CurrAmmo > 0)
+ else
{
//手动上膛
_beLoadedState = 0;
@@ -1193,6 +1218,7 @@
private void ReloadFinishHandler()
{
// GD.Print("装弹完成.");
+ _beLoadedState = 2;
OnReloadFinish();
}
@@ -1206,6 +1232,12 @@
//上膛处理
private void BeLoadedHandler()
{
+ //上膛抛弹
+ if (!Attribute.ContinuousShoot && Attribute.BeLoadedTime > 0 && Attribute.ShellId != null)
+ {
+ ThrowShellHandler(0.6f);
+ }
+
//开始上膛
OnBeginBeLoaded();
@@ -1239,6 +1271,20 @@
PlayBeLoadedSound();
}
+ //抛弹逻辑
+ private void ThrowShellHandler(float speedScale)
+ {
+ //创建一个弹壳
+ if (Attribute.ThrowShellDelayTime > 0)
+ {
+ CallDelay(Attribute.ThrowShellDelayTime, () => ThrowShell(Attribute.ShellId, speedScale));
+ }
+ else if (Attribute.ThrowShellDelayTime == 0)
+ {
+ ThrowShell(Attribute.ShellId, speedScale);
+ }
+ }
+
//停止当前的换弹状态
private void StopReloadState()
{
@@ -1565,16 +1611,16 @@
///
/// 投抛弹壳的默认实现方式, shellId为弹壳id
///
- protected ActivityObject ThrowShell(string shellId)
+ protected ActivityObject ThrowShell(string shellId, float speedScale = 1)
{
var shellPosition = Master.MountPoint.Position + ShellPoint.Position;
var startPos = ShellPoint.GlobalPosition;
var startHeight = -shellPosition.Y;
startPos.Y += startHeight;
var direction = GlobalRotationDegrees + Utils.RandomRangeInt(-30, 30) + 180;
- var verticalSpeed = Utils.RandomRangeInt(60, 120);
- var velocity = new Vector2(Utils.RandomRangeInt(20, 60), 0).Rotated(direction * Mathf.Pi / 180);
- var rotate = Utils.RandomRangeInt(-720, 720);
+ var verticalSpeed = Utils.RandomRangeInt((int)(60 * speedScale), (int)(120 * speedScale));
+ var velocity = new Vector2(Utils.RandomRangeInt((int)(20 * speedScale), (int)(60 * speedScale)), 0).Rotated(direction * Mathf.Pi / 180);
+ var rotate = Utils.RandomRangeInt((int)(-720 * speedScale), (int)(720 * speedScale));
var shell = Create(shellId);
shell.Rotation = Master.MountPoint.RealRotation;
shell.InheritVelocity(Master);
diff --git a/DungeonShooting_Godot/src/game/activity/weapon/gun/Gun.cs b/DungeonShooting_Godot/src/game/activity/weapon/gun/Gun.cs
index b8c0485..3cf6b0d 100644
--- a/DungeonShooting_Godot/src/game/activity/weapon/gun/Gun.cs
+++ b/DungeonShooting_Godot/src/game/activity/weapon/gun/Gun.cs
@@ -8,9 +8,6 @@
{
protected override void OnFire()
{
- //创建一个弹壳
- ThrowShell(Attribute.ShellId);
-
if (Master == Player.Current)
{
//创建抖动