59 lines
1.5 KiB
C#
59 lines
1.5 KiB
C#
using System.Collections.Generic;
|
|
using Framework;
|
|
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} {runtimeData.configData.NameRead} 目标:{targetCellIndex}");
|
|
runtimeData.remainCDTime = runtimeData.configData.CDTime;
|
|
owner._UseSkill(targetCellIndex, this);
|
|
|
|
if (owner.debugShowInfo.cacheConfigId != 0)
|
|
{
|
|
EventManager.Instance.Send(EventManager.EventName.INFIGHT_AUDIO_USE_SKILL, owner.debugShowInfo.cacheConfigId);
|
|
}
|
|
}
|
|
|
|
public void TriggerSkillEnd()
|
|
{
|
|
// 技能结束时触发,重置技能CD
|
|
|
|
}
|
|
}
|
|
}
|