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

47 lines
1.1 KiB
C#
Raw Normal View History

2023-12-28 13:49:45 +08:00
using System.Collections.Generic;
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)
{
2023-10-19 15:00:19 +08:00
runtimeData.remainCDTime -= dt;
2023-08-22 19:08:45 +08:00
}
public void Use(int targetCellIndex)
{
DebugUtil.LogG($"owner:{owner.GetUnitDesc()} 释放技能:{runtimeData.configData.ID} 目标:{targetCellIndex}");
2023-08-22 19:08:45 +08:00
runtimeData.remainCDTime = runtimeData.configData.CDTime;
owner._UseSkill(targetCellIndex, this);
2023-08-22 19:08:45 +08:00
}
}
}