47 lines
1.1 KiB
C#
47 lines
1.1 KiB
C#
using System.Collections.Generic;
|
|
using Gameplay.Unit;
|
|
|
|
namespace Gameplay.Skill
|
|
{
|
|
using cfg.SkillCfg;
|
|
|
|
public class SkillHandle
|
|
{
|
|
|
|
public readonly GameUnit owner;
|
|
|
|
public List<uint> cacheHitUnitIds = new List<uint>();
|
|
|
|
public readonly SkillRuntimeData runtimeData;
|
|
|
|
public bool canRelease
|
|
{
|
|
get
|
|
{
|
|
return runtimeData.remainCDTime <= 0;
|
|
}
|
|
}
|
|
|
|
public SkillHandle(GameUnit owner, DataSkill configData)
|
|
{
|
|
this.owner = owner;
|
|
runtimeData = new SkillRuntimeData(configData);
|
|
|
|
// 一开始处于可释放状态
|
|
runtimeData.remainCDTime = 0;
|
|
}
|
|
|
|
public void LogicUpdate(float dt)
|
|
{
|
|
runtimeData.remainCDTime -= dt;
|
|
}
|
|
|
|
public void Use(int targetCellIndex)
|
|
{
|
|
DebugUtil.LogG($"owner:{owner.GetUnitDesc()} 释放技能:{runtimeData.configData.ID} 目标:{targetCellIndex}");
|
|
runtimeData.remainCDTime = runtimeData.configData.CDTime;
|
|
owner._UseSkill(targetCellIndex, this);
|
|
}
|
|
}
|
|
}
|