diff --git a/DungeonShooting_Godot/src/game/activity/weapon/Weapon.cs b/DungeonShooting_Godot/src/game/activity/weapon/Weapon.cs index 2f4a139..87408d0 100644 --- a/DungeonShooting_Godot/src/game/activity/weapon/Weapon.cs +++ b/DungeonShooting_Godot/src/game/activity/weapon/Weapon.cs @@ -306,7 +306,7 @@ private void InitWeapon(ExcelConfig.WeaponBase attribute) { _playerWeaponAttribute = attribute; - _weaponAttribute = attribute; + SetCurrentWeaponAttribute(attribute); if (attribute.AiUseAttribute != null) { _aiWeaponAttribute = attribute.AiUseAttribute; @@ -733,13 +733,13 @@ { TriggerRole = triggerRole; TriggerRoleAttackLayer = triggerRole.AttackLayer; - _weaponAttribute = triggerRole.IsAi ? _aiWeaponAttribute : _playerWeaponAttribute; + SetCurrentWeaponAttribute(triggerRole.IsAi ? _aiWeaponAttribute : _playerWeaponAttribute); } else if (Master != null) { TriggerRole = Master; TriggerRoleAttackLayer = Master.AttackLayer; - _weaponAttribute = Master.IsAi ? _aiWeaponAttribute : _playerWeaponAttribute; + SetCurrentWeaponAttribute(Master.IsAi ? _aiWeaponAttribute : _playerWeaponAttribute); } //是否第一帧按下 @@ -1908,7 +1908,7 @@ } GetParent().RemoveChild(this); _triggerRoleFlag = false; - _weaponAttribute = _playerWeaponAttribute; + SetCurrentWeaponAttribute(_playerWeaponAttribute); CollisionLayer = _tempLayer; //精灵位置, 旋转中心点 @@ -1934,7 +1934,7 @@ { Pickup(); _triggerRoleFlag = true; - _weaponAttribute = Master.IsAi ? _aiWeaponAttribute : _playerWeaponAttribute; + SetCurrentWeaponAttribute(Master.IsAi ? _aiWeaponAttribute : _playerWeaponAttribute); //停止动画 AnimationPlayer.Stop(); //清除泛白效果 @@ -2014,7 +2014,18 @@ { return _gripPoint + _gripOffset; } - + + //设置当前使用的武器属性 + private void SetCurrentWeaponAttribute(ExcelConfig.WeaponBase attr) + { + if (attr != _weaponAttribute) + { + _weaponAttribute = attr; + //重置开火速率 + CurrentFiringSpeed = _weaponAttribute.StartFiringSpeed; + } + } + //-------------------------------- Ai相关 ----------------------------- ///