NLDClient-yudde/ProjectNLD/Assets/Code/Scripts/Gameplay/Skill/Charge/SkillChargeEnergy.cs

55 lines
1.4 KiB
C#

using Gameplay.Common;
namespace Gameplay.Skill.Charge
{
public class SkillChargeEnergy : BaseSkillCharge
{
private readonly float _maxEnergyValue;
private float _nowEnergyValue;
public SkillChargeEnergy(SkillHandle skillHandle) : base(skillHandle)
{
_maxEnergyValue = rawConfig.ChargeParam;
_nowEnergyValue = 0f;
}
private void _AddEnergy(float addValue)
{
if (nowStoreCount < _maxStoreCount)
{
_nowEnergyValue += addValue;
if (_nowEnergyValue >= _maxEnergyValue)
{
_nowEnergyValue = 0f;
nowStoreCount++;
chargeProgress = 1f;
}
else
{
chargeProgress = _nowEnergyValue / _maxEnergyValue;
}
}
else
{
chargeProgress = 1f;
}
}
protected override void _OnNormalAttack()
{
base._OnNormalAttack();
_AddEnergy(GLConfig.Inst.data.SkillChargeNormalAttack);
}
protected override void _OnBeAttack()
{
base._OnBeAttack();
_AddEnergy(GLConfig.Inst.data.SkillChargeBeAttack);
}
}
}