Files
zeling_v2/Assets/_Game/Scripts/Equipment/Effects/AttackSpeedEffect.cs

29 lines
867 B
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using System;
using UnityEngine;
namespace BaseGames.Equipment
{
/// <summary>
/// 攻击速度加成护符效果(架构 09_ProgressionModule §5
/// 修改 PlayerStats.AnimatorSpeedMultiplier动画控制器查询该倒数应用速度。
/// </summary>
[Serializable]
public class AttackSpeedEffect : ICharmEffect
{
[Range(0.1f, 2.0f)]
public float speedMultiplier = 1.2f; // 动画速度倍率1.2 = 加速 20%
public void OnEquip(EquipmentContext ctx)
{
ctx.Stats?.AddAnimatorSpeedBonus(speedMultiplier - 1f);
}
public void OnUnequip(EquipmentContext ctx)
{
ctx.Stats?.RemoveAnimatorSpeedBonus(speedMultiplier - 1f);
}
public string GetEffectDescription() => $"攻击速度 +{(speedMultiplier - 1f) * 100:0}%";
}
}