diff --git a/DungeonShooting_Godot/DungeonShooting.csproj b/DungeonShooting_Godot/DungeonShooting.csproj index b35ce8d..65ee589 100644 --- a/DungeonShooting_Godot/DungeonShooting.csproj +++ b/DungeonShooting_Godot/DungeonShooting.csproj @@ -1,4 +1,4 @@ - + net7.0 true diff --git a/DungeonShooting_Godot/excel/excelFile/ActivityObject.xlsx b/DungeonShooting_Godot/excel/excelFile/ActivityObject.xlsx index 52049a3..508bcd9 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/AiAttackAttr.xlsx b/DungeonShooting_Godot/excel/excelFile/AiAttackAttr.xlsx index c091459..152aabd 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/Sound.xlsx b/DungeonShooting_Godot/excel/excelFile/Sound.xlsx index 3e266b2..a17d8a7 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 ee67233..7602be4 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/AiAttackAttr.json b/DungeonShooting_Godot/resource/config/AiAttackAttr.json index 2188c73..010c512 100644 --- a/DungeonShooting_Godot/resource/config/AiAttackAttr.json +++ b/DungeonShooting_Godot/resource/config/AiAttackAttr.json @@ -5,7 +5,9 @@ "FiringStand": true, "ShowSubline": false, "LockingTime": 1, - "BulletSpeedScale": 0.35, + "LockAngleTime": 0, + "AttackLockAngle": true, + "BulletSpeedScale": 0.4, "AmmoConsumptionProbability": 0 }, { @@ -14,6 +16,8 @@ "FiringStand": true, "ShowSubline": false, "LockingTime": 2, + "LockAngleTime": 0, + "AttackLockAngle": false, "BulletSpeedScale": 0.35, "AmmoConsumptionProbability": 0 }, @@ -23,6 +27,8 @@ "FiringStand": true, "ShowSubline": false, "LockingTime": 1, + "LockAngleTime": 0, + "AttackLockAngle": false, "BulletSpeedScale": 0.35, "AmmoConsumptionProbability": 0 }, @@ -32,6 +38,8 @@ "FiringStand": false, "ShowSubline": false, "LockingTime": 0.7, + "LockAngleTime": 0, + "AttackLockAngle": true, "BulletSpeedScale": 0.35, "AmmoConsumptionProbability": 0 }, @@ -41,7 +49,9 @@ "FiringStand": true, "ShowSubline": true, "LockingTime": 1.5, - "BulletSpeedScale": 0.35, + "LockAngleTime": 0.5, + "AttackLockAngle": true, + "BulletSpeedScale": 0.5, "AmmoConsumptionProbability": 0 }, { @@ -49,7 +59,9 @@ "Remark": "", "FiringStand": true, "ShowSubline": false, - "LockingTime": 1.5, + "LockingTime": 0.5, + "LockAngleTime": 0.5, + "AttackLockAngle": false, "BulletSpeedScale": 0.35, "AmmoConsumptionProbability": 0 } diff --git a/DungeonShooting_Godot/src/config/ExcelConfig_AiAttackAttr.cs b/DungeonShooting_Godot/src/config/ExcelConfig_AiAttackAttr.cs index 660f4b9..0dceead 100644 --- a/DungeonShooting_Godot/src/config/ExcelConfig_AiAttackAttr.cs +++ b/DungeonShooting_Godot/src/config/ExcelConfig_AiAttackAttr.cs @@ -39,6 +39,21 @@ public float LockingTime; /// + /// 从锁定目标到开火前有多少时间不能够改变枪口角度
+ /// 这个值必须小于LockingTime
+ /// 如果为0, 则不会锁定开火角度
+ /// (单位: 秒) + ///
+ [JsonInclude] + public float LockAngleTime; + + /// + /// 开火时是否锁定枪口角度 + /// + [JsonInclude] + public bool AttackLockAngle; + + /// /// Ai属性
/// Ai使用该武器发射的子弹速度缩放比 ///
@@ -63,6 +78,8 @@ inst.FiringStand = FiringStand; inst.ShowSubline = ShowSubline; inst.LockingTime = LockingTime; + inst.LockAngleTime = LockAngleTime; + inst.AttackLockAngle = AttackLockAngle; inst.BulletSpeedScale = BulletSpeedScale; inst.AmmoConsumptionProbability = AmmoConsumptionProbability; return inst; diff --git a/DungeonShooting_Godot/src/game/activity/role/Role.cs b/DungeonShooting_Godot/src/game/activity/role/Role.cs index cb4d86b..7269052 100644 --- a/DungeonShooting_Godot/src/game/activity/role/Role.cs +++ b/DungeonShooting_Godot/src/game/activity/role/Role.cs @@ -450,7 +450,7 @@ } //看向目标 - if (LookTarget != null) + if (LookTarget != null && MountLookTarget) { Vector2 pos = LookTarget.GlobalPosition; //脸的朝向 @@ -463,12 +463,8 @@ { Face = FaceDirection.Left; } - - if (MountLookTarget) - { - //枪口跟随目标 - MountPoint.SetLookAt(pos); - } + //枪口跟随目标 + MountPoint.SetLookAt(pos); } //检查可互动的物体 @@ -656,19 +652,18 @@ public void LookTargetPosition(Vector2 pos) { LookTarget = null; - //脸的朝向 - var gPos = GlobalPosition; - if (pos.X > gPos.X && Face == FaceDirection.Left) - { - Face = FaceDirection.Right; - } - else if (pos.X < gPos.X && Face == FaceDirection.Right) - { - Face = FaceDirection.Left; - } - if (MountLookTarget) { + //脸的朝向 + var gPos = GlobalPosition; + if (pos.X > gPos.X && Face == FaceDirection.Left) + { + Face = FaceDirection.Right; + } + else if (pos.X < gPos.X && Face == FaceDirection.Right) + { + Face = FaceDirection.Left; + } //枪口跟随目标 MountPoint.SetLookAt(pos); } diff --git a/DungeonShooting_Godot/src/game/activity/role/enemy/Enemy.cs b/DungeonShooting_Godot/src/game/activity/role/enemy/Enemy.cs index 1a4017c..4736952 100644 --- a/DungeonShooting_Godot/src/game/activity/role/enemy/Enemy.cs +++ b/DungeonShooting_Godot/src/game/activity/role/enemy/Enemy.cs @@ -167,36 +167,64 @@ _lockTargetTime = 0; } - //更新瞄准辅助线 - if (weapon.Attribute.AiAttackAttr.ShowSubline && AttackState == AiAttackState.LockingTime) + if (AttackState == AiAttackState.LockingTime) //锁定玩家状态 { - if (SubLine == null) + var aiLockRemainderTime = weapon.GetAiLockRemainderTime(); + MountLookTarget = aiLockRemainderTime >= weapon.Attribute.AiAttackAttr.LockAngleTime; + //更新瞄准辅助线 + if (weapon.Attribute.AiAttackAttr.ShowSubline) { - InitSubLine(); + if (SubLine == null) + { + InitSubLine(); + } + else + { + SubLine.Enable = true; + } + + //播放警告删掉动画 + if (!SubLine.IsPlayWarnAnimation && aiLockRemainderTime <= 0.5f) + { + SubLine.PlayWarnAnimation(0.5f); + } + } + } + else + { + //关闭辅助线 + if (SubLine != null) + { + SubLine.Enable = false; + } + + if (AttackState == AiAttackState.Attack || AttackState == AiAttackState.AttackInterval) + { + if (weapon.Attribute.AiAttackAttr.AttackLockAngle) //开火时锁定枪口角度 + { + //连发状态锁定角度 + MountLookTarget = !(weapon.GetContinuousCount() > 0 || weapon.GetAttackTimer() > 0); + } + else + { + MountLookTarget = true; + } } else { - SubLine.Enable = true; + MountLookTarget = true; } - - //播放警告删掉动画 - if (!SubLine.IsPlayWarnAnimation && weapon.GetAiLockRemainderTime() <= 0.5f) - { - SubLine.PlayWarnAnimation(0.5f); - } - } - else if (SubLine != null) - { - SubLine.Enable = false; } } else { + MountLookTarget = true; _lockTargetTime = 0; } } else { + MountLookTarget = true; _lockTargetTime = 0; } diff --git a/DungeonShooting_Godot/src/game/activity/weapon/Weapon.cs b/DungeonShooting_Godot/src/game/activity/weapon/Weapon.cs index a481cff..3bead8a 100644 --- a/DungeonShooting_Godot/src/game/activity/weapon/Weapon.cs +++ b/DungeonShooting_Godot/src/game/activity/weapon/Weapon.cs @@ -164,7 +164,7 @@ private bool _triggerFlag = false; //扳机计时器 - public float _triggerTimer = 0; + private float _triggerTimer = 0; //开火前延时时间 private float _delayedTime = 0; @@ -176,7 +176,7 @@ private float _fireAngle = 0; //攻击冷却计时 - public float _attackTimer = 0; + private float _attackTimer = 0; //攻击状态 private bool _attackFlag = false; @@ -877,6 +877,14 @@ } /// + /// 获取攻击冷却计时时间, 等于 0 表示冷却完成 + /// + public float GetAttackTimer() + { + return _attackTimer; + } + + /// /// 返回是否是攻击间隙时间 /// public bool IsAttackIntervalTime()