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

65 lines
1.7 KiB
C#
Raw Normal View History

2023-12-28 13:49:45 +08:00
using System.Collections.Generic;
using Framework;
2023-12-13 16:20:41 +08:00
using Gameplay.Unit;
2023-08-22 19:08:45 +08:00
namespace Gameplay.Skill
{
using cfg.SkillCfg;
2023-10-19 15:00:19 +08:00
public class SkillHandle
2023-08-22 19:08:45 +08:00
{
2023-10-19 15:00:19 +08:00
public readonly GameUnit owner;
public List<uint> cacheHitUnitIds = new List<uint>();
2023-08-22 19:08:45 +08:00
2023-10-19 15:00:19 +08:00
public readonly SkillRuntimeData runtimeData;
2023-08-22 19:08:45 +08:00
public bool canRelease
{
get
{
return runtimeData.remainCDTime <= 0;
}
}
2023-10-19 15:00:19 +08:00
public SkillHandle(GameUnit owner, DataSkill configData)
2023-08-22 19:08:45 +08:00
{
this.owner = owner;
2023-10-19 15:00:19 +08:00
runtimeData = new SkillRuntimeData(configData);
2023-08-22 19:08:45 +08:00
// 一开始处于可释放状态
2023-10-19 15:00:19 +08:00
runtimeData.remainCDTime = 0;
2023-08-22 19:08:45 +08:00
}
public void LogicUpdate(float dt)
{
var scale = owner.fightData.skillCdReduceScale;
runtimeData.remainCDTime -= dt * scale;
}
public void ReduceSkillCd(float reduceTime)
{
runtimeData.remainCDTime -= reduceTime;
2023-08-22 19:08:45 +08:00
}
public void Use(int targetCellIndex)
{
2024-05-17 15:37:56 +08:00
DebugUtil.LogG($"owner:{owner.GetUnitDesc()} 释放技能:{runtimeData.configData.ID} {runtimeData.configData.NameRead} 目标:{targetCellIndex}");
runtimeData.remainCDTime = runtimeData.maxCdTime;
owner._UseSkill(targetCellIndex, this);
if (owner.debugShowInfo.cacheConfigId != 0)
{
EventManager.Instance.Send(EventManager.EventName.INFIGHT_AUDIO_USE_SKILL, owner.debugShowInfo.cacheConfigId);
}
2023-08-22 19:08:45 +08:00
}
public void TriggerSkillEnd()
{
// 技能结束时触发,重置技能CD
}
2023-08-22 19:08:45 +08:00
}
}