2023-12-28 13:49:45 +08:00
|
|
|
|
using System.Collections.Generic;
|
2024-06-12 19:09:10 +08:00
|
|
|
|
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;
|
2023-11-15 13:15:57 +08:00
|
|
|
|
|
|
|
|
|
|
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)
|
|
|
|
|
|
{
|
2024-07-17 19:11:14 +08:00
|
|
|
|
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}");
|
2024-07-17 19:11:14 +08:00
|
|
|
|
runtimeData.remainCDTime = runtimeData.maxCdTime;
|
2023-12-26 13:00:53 +08:00
|
|
|
|
owner._UseSkill(targetCellIndex, this);
|
2024-06-12 19:09:10 +08:00
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
}
|
2024-03-28 13:19:52 +08:00
|
|
|
|
|
|
|
|
|
|
public void TriggerSkillEnd()
|
|
|
|
|
|
{
|
|
|
|
|
|
// 技能结束时触发,重置技能CD
|
|
|
|
|
|
|
|
|
|
|
|
}
|
2023-08-22 19:08:45 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|