diff --git a/DungeonShooting_Godot/excel/ActivePropBase.xlsx b/DungeonShooting_Godot/excel/ActivePropBase.xlsx index 691f27f..65bdb9c 100644 --- a/DungeonShooting_Godot/excel/ActivePropBase.xlsx +++ b/DungeonShooting_Godot/excel/ActivePropBase.xlsx Binary files differ diff --git a/DungeonShooting_Godot/prefab/prop/activeComp/Prop5003_Area.tscn b/DungeonShooting_Godot/prefab/prop/activeComp/Prop5003_Area.tscn index dc53880..e5612df 100644 --- a/DungeonShooting_Godot/prefab/prop/activeComp/Prop5003_Area.tscn +++ b/DungeonShooting_Godot/prefab/prop/activeComp/Prop5003_Area.tscn @@ -11,7 +11,7 @@ height = 128 fill = 1 fill_from = Vector2(0.5, 0.5) -fill_to = Vector2(0.827839, 0.291819) +fill_to = Vector2(1, 0.5) [sub_resource type="CircleShape2D" id="CircleShape2D_1llif"] radius = 15.0333 diff --git a/DungeonShooting_Godot/resource/config/ActivePropBase.json b/DungeonShooting_Godot/resource/config/ActivePropBase.json index 888129d..b43aeff 100644 --- a/DungeonShooting_Godot/resource/config/ActivePropBase.json +++ b/DungeonShooting_Godot/resource/config/ActivePropBase.json @@ -63,14 +63,16 @@ "Buff": null, "Condition": null, "Effect": { - "AreaTrigger": [] + "AreaTrigger": [ + 200 + ] }, "Charge": { "Hurt": [ - 100 + 250 ] }, - "Duration": 0, + "Duration": 6, "CooldownTime": 0, "IsConsumables": false, "MaxCount": 1 diff --git a/DungeonShooting_Godot/resource/sprite/brush/Brush2.png b/DungeonShooting_Godot/resource/sprite/brush/Brush2.png index b74c0ed..a2dbff1 100644 --- a/DungeonShooting_Godot/resource/sprite/brush/Brush2.png +++ b/DungeonShooting_Godot/resource/sprite/brush/Brush2.png Binary files differ diff --git a/DungeonShooting_Godot/resource/sprite/brush/Brush3.png b/DungeonShooting_Godot/resource/sprite/brush/Brush3.png index c77fef5..7fda7b3 100644 --- a/DungeonShooting_Godot/resource/sprite/brush/Brush3.png +++ b/DungeonShooting_Godot/resource/sprite/brush/Brush3.png Binary files differ diff --git a/DungeonShooting_Godot/resource/sprite/brush/Brush4.png b/DungeonShooting_Godot/resource/sprite/brush/Brush4.png index 5a7a53d..2ad96ea 100644 --- a/DungeonShooting_Godot/resource/sprite/brush/Brush4.png +++ b/DungeonShooting_Godot/resource/sprite/brush/Brush4.png Binary files differ diff --git a/DungeonShooting_Godot/resource/sprite/brush/Brush5.png b/DungeonShooting_Godot/resource/sprite/brush/Brush5.png index 0d36bb0..97f25ca 100644 --- a/DungeonShooting_Godot/resource/sprite/brush/Brush5.png +++ b/DungeonShooting_Godot/resource/sprite/brush/Brush5.png Binary files differ diff --git a/DungeonShooting_Godot/src/config/ExcelConfig_ActivePropBase.cs b/DungeonShooting_Godot/src/config/ExcelConfig_ActivePropBase.cs index 7b768b7..f4f6479 100644 --- a/DungeonShooting_Godot/src/config/ExcelConfig_ActivePropBase.cs +++ b/DungeonShooting_Godot/src/config/ExcelConfig_ActivePropBase.cs @@ -60,8 +60,7 @@ /// /// 使用道具的效果持续时间
- /// 单位: 秒
- /// 注意: 该持续时间与具体道具属性片段无关, 仅用于程序计算何时可以开始冷却道具 + /// 单位: 秒 ///
[JsonInclude] public float Duration; diff --git a/DungeonShooting_Godot/src/game/activity/prop/ActiveProp.cs b/DungeonShooting_Godot/src/game/activity/prop/ActiveProp.cs index db75ee7..6a9cafb 100644 --- a/DungeonShooting_Godot/src/game/activity/prop/ActiveProp.cs +++ b/DungeonShooting_Godot/src/game/activity/prop/ActiveProp.cs @@ -84,8 +84,20 @@ /// public float AutoChargeSpeed { get; set; } + /// + /// 是否正使用中 + /// + public bool IsUsing => _durationTimer > 0; + + /// + /// 道具使用时间进度 (0 - 1) + /// + public float UsingProgress => 1 - _durationTimer / Attribute.Duration; + //冷却计时器 private float _cooldownTimer = 0; + //持续时间计时器 + private float _durationTimer = 0; //被动属性 private readonly List _buffFragment = new List(); @@ -331,6 +343,14 @@ { fragment.OnUse(); } + + } + + /// + /// 道具使用持续时间完成时调用 + /// + protected virtual void OnUsingFinish() + { } /// @@ -367,8 +387,23 @@ { return; } + + //持续时间 + if (_durationTimer > 0) + { + _durationTimer -= delta; + + //持续时间完成 + if (_durationTimer <= 0) + { + _durationTimer = 0; + //冷却计时器 + _cooldownTimer = Attribute.CooldownTime; + UsingFinish(); + } + } //冷却 - if (_cooldownTimer > 0) + else if (_cooldownTimer > 0) { _cooldownTimer -= delta; @@ -416,7 +451,7 @@ /// public void Use() { - if (Master == null) + if (Master == null || IsUsing) { return; } @@ -428,8 +463,16 @@ Count -= 1; } - //冷却计时器 - _cooldownTimer = Attribute.CooldownTime; + if (Attribute.Duration > 0) //持续时间 + { + _durationTimer = Attribute.Duration; + } + else + { + //冷却计时器 + _cooldownTimer = Attribute.CooldownTime; + UsingFinish(); + } } } @@ -652,6 +695,22 @@ fragment.OnPickUpItem(); } } + + //持续时间完成 + private void UsingFinish() + { + OnUsingFinish(); + + foreach (var effectFragment in _effectFragment) + { + effectFragment.OnUsingFinish(); + } + + foreach (var chargeFragment in _chargeFragment) + { + chargeFragment.OnUsingFinish(); + } + } private static bool _init = false; diff --git a/DungeonShooting_Godot/src/game/activity/weapon/Weapon.cs b/DungeonShooting_Godot/src/game/activity/weapon/Weapon.cs index 8bfe7c2..585d60c 100644 --- a/DungeonShooting_Godot/src/game/activity/weapon/Weapon.cs +++ b/DungeonShooting_Godot/src/game/activity/weapon/Weapon.cs @@ -257,6 +257,9 @@ //抖动计时器 private float _shakeTimer = 0; + + //换弹完成后播放的动画 + private string _reloadNextAnimation; // ---------------------------------------------- private uint _tempLayer; @@ -805,6 +808,25 @@ } /// + /// 清除触发角色开火标记数据 + /// + public void ClearTriggerRole() + { + _triggerRoleFlag = false; + if (Master == null) + { + if (Reloading) + { + _reloadNextAnimation = AnimatorNames.Floodlight; + } + else + { + AnimationPlayer.Play(AnimatorNames.Floodlight); + } + } + } + + /// /// 扳机函数, 调用即视为按下扳机 /// /// 按下扳机的角色, 如果传 null, 则视为走火 @@ -819,6 +841,10 @@ //更新武器属性信息 _triggerFlag = true; + if (!_triggerRoleFlag && AnimationPlayer.CurrentAnimation == AnimatorNames.Floodlight) + { + AnimationPlayer.Play(AnimatorNames.Reset); + } _triggerRoleFlag = true; _triggerCalcAmmon = calcAmmo; if (triggerRole != null) @@ -1598,6 +1624,11 @@ private void ReloadFinishHandler() { // Debug.Log("装弹完成."); + if (_reloadNextAnimation != null) + { + AnimationPlayer.Play(_reloadNextAnimation); + _reloadNextAnimation = null; + } OnReloadFinish(); } diff --git a/DungeonShooting_Godot/src/game/buff/ChargeFragment.cs b/DungeonShooting_Godot/src/game/buff/ChargeFragment.cs index 888c81f..2ee8130 100644 --- a/DungeonShooting_Godot/src/game/buff/ChargeFragment.cs +++ b/DungeonShooting_Godot/src/game/buff/ChargeFragment.cs @@ -14,6 +14,13 @@ /// public abstract void OnUse(); + /// + /// 道具持续时间完成时调用 + /// + public virtual void OnUsingFinish() + { + } + public override void OnPickUpItem() { } diff --git a/DungeonShooting_Godot/src/game/buff/EffectFragment.cs b/DungeonShooting_Godot/src/game/buff/EffectFragment.cs index de0ea3c..a38bc0d 100644 --- a/DungeonShooting_Godot/src/game/buff/EffectFragment.cs +++ b/DungeonShooting_Godot/src/game/buff/EffectFragment.cs @@ -21,6 +21,13 @@ /// 使用道具的回调 /// public abstract void OnUse(); + + /// + /// 道具持续时间完成时调用 + /// + public virtual void OnUsingFinish() + { + } public override void OnPickUpItem() { diff --git a/DungeonShooting_Godot/src/game/buff/charge/Cha_Hurt.cs b/DungeonShooting_Godot/src/game/buff/charge/Cha_Hurt.cs index 3536175..36c7885 100644 --- a/DungeonShooting_Godot/src/game/buff/charge/Cha_Hurt.cs +++ b/DungeonShooting_Godot/src/game/buff/charge/Cha_Hurt.cs @@ -12,6 +12,19 @@ public override void OnUse() { + + } + + public override void Process(float delta) + { + if (Master.IsUsing) + { + Master.ChargeProgress = 1 - Master.UsingProgress; + } + } + + public override void OnUsingFinish() + { Master.ChargeProgress = 0; } @@ -27,6 +40,10 @@ private void OnDamageEvent(Role role, int value) { + if (Master.IsUsing) + { + return; + } Master.ChargeProgress += 1f / _value * value; } } \ No newline at end of file diff --git a/DungeonShooting_Godot/src/game/buff/effect/Eff_AreaTrigger.cs b/DungeonShooting_Godot/src/game/buff/effect/Eff_AreaTrigger.cs index aa6bfc1..69c0e16 100644 --- a/DungeonShooting_Godot/src/game/buff/effect/Eff_AreaTrigger.cs +++ b/DungeonShooting_Godot/src/game/buff/effect/Eff_AreaTrigger.cs @@ -2,12 +2,22 @@ using System.Collections.Generic; using Godot; -[EffectFragment("AreaTrigger", "")] +[EffectFragment("AreaTrigger", + "触发附近地上的武器开火, " + + "参数1为最大作用半径, ")] public class Eff_AreaTrigger : EffectFragment { private Prop5003Area _areaNode; private List _weaponList = new List(); + private float _time = 0; + private int _radius = 250; + + public override void InitParam(float arg1) + { + _radius = (int)arg1; + } + public override void Ready() { _areaNode = ResourceManager.LoadAndInstantiate(ResourcePath.prefab_prop_activeComp_Prop5003_Area_tscn); @@ -23,19 +33,57 @@ public override void OnUse() { - _areaNode.PlayEffect(0, 250, 6); + _areaNode.PlayEffect(0, _radius, Master.Attribute.Duration); + } + + public override void OnUsingFinish() + { + foreach (var weapon in _weaponList) + { + weapon.ClearTriggerRole(); + } + _weaponList.Clear(); } public override void Process(float delta) { + if (!Master.IsUsing) + { + _time = 0; + return; + } + _time += delta; + var flag = false; + if (_time >= 0.5f) + { + flag = true; + _time %= 0.5f; + } for (var i = 0; i < _weaponList.Count; i++) { var weapon = _weaponList[i]; if (weapon.Master != null) { _weaponList.RemoveAt(i--); + weapon.ClearTriggerRole(); continue; } + + if (flag) + { + var weaponBase = weapon.GetUseAttribute(Role); + if (!weaponBase.ContinuousShoot) + { + if (!weaponBase.LooseShoot) + { + continue; + } + else if (!weapon.IsCharging || weapon.IsChargeFinish()) + { + continue; + } + } + } weapon.Trigger(Role, false); } } @@ -67,7 +115,10 @@ { if (node is Weapon weapon && weapon.Master == null) { - _weaponList.Remove(weapon); + if (_weaponList.Remove(weapon)) + { + weapon.ClearTriggerRole(); + } } } } \ No newline at end of file diff --git a/DungeonShooting_Godot/src/game/buffComp/active/Prop5003Area.cs b/DungeonShooting_Godot/src/game/buffComp/active/Prop5003Area.cs index cd394b4..8177940 100644 --- a/DungeonShooting_Godot/src/game/buffComp/active/Prop5003Area.cs +++ b/DungeonShooting_Godot/src/game/buffComp/active/Prop5003Area.cs @@ -22,30 +22,30 @@ public void PlayEffect(int startRadius, int endRadius, float time) { - var _tween = CreateTween(); - _tween.SetParallel(); - _tween.TweenCallback(Callable.From(() => + var tween = CreateTween(); + tween.SetParallel(); + tween.TweenCallback(Callable.From(() => { SetEnable(true); Modulate = Colors.White; })); - _tween.Chain(); + tween.Chain(); - _tween.TweenMethod(Callable.From(SetRadius), startRadius, endRadius * 0.75f, time * 0.2f); - _tween.Chain(); + tween.TweenMethod(Callable.From(SetRadius), startRadius, endRadius * 0.75f, time * 0.2f); + tween.Chain(); - _tween.TweenInterval(time * 0.55f); - _tween.Chain(); + tween.TweenInterval(time * 0.55f); + tween.Chain(); - _tween.TweenMethod(Callable.From(SetRadius), endRadius * 0.75f, endRadius, time * 0.25f); - _tween.TweenProperty(this, "modulate", new Color(1, 1, 1, 0), time * 0.25f); - _tween.Chain(); + tween.TweenMethod(Callable.From(SetRadius), endRadius * 0.75f, endRadius, time * 0.25f); + tween.TweenProperty(this, "modulate", new Color(1, 1, 1, 0), time * 0.25f); + tween.Chain(); - _tween.TweenCallback(Callable.From(() => + tween.TweenCallback(Callable.From(() => { SetEnable(false); })); - _tween.Play(); + tween.Play(); } private void SetRadius(int radius)