125 lines
3.4 KiB
C#
125 lines
3.4 KiB
C#
using System.Collections.Generic;
|
|
using Framework;
|
|
using Gameplay.Common;
|
|
using Gameplay.Skill.Charge;
|
|
using Gameplay.Unit;
|
|
|
|
namespace Gameplay.Skill
|
|
{
|
|
using cfg.SkillCfg;
|
|
using Guide;
|
|
using Level;
|
|
|
|
public class SkillHandle
|
|
{
|
|
|
|
public readonly GameUnit owner;
|
|
|
|
public List<uint> cacheHitUnitIds = new List<uint>();
|
|
|
|
public readonly SkillRuntimeData runtimeData;
|
|
|
|
public ISkillCharge chargeLogic { get; private set; }
|
|
|
|
public bool canRelease
|
|
{
|
|
get
|
|
{
|
|
if (CodeDefine.Fight.SkipSkillCDCheck)
|
|
{
|
|
return true;
|
|
}
|
|
if (!owner.isReady) return false;
|
|
if (owner.statusData.isDead) return false;
|
|
return chargeLogic.nowStoreCount > 0;
|
|
}
|
|
}
|
|
|
|
public SkillHandle(GameUnit owner, DataSkill configData)
|
|
{
|
|
this.owner = owner;
|
|
runtimeData = new SkillRuntimeData(configData);
|
|
chargeLogic = SkillChargeFactory.CreateChargeLogic(this);
|
|
|
|
_InitForGuide();
|
|
}
|
|
|
|
private void _InitForGuide()
|
|
{
|
|
if (GuideManager.Instance.IsGuiding && // 新手引导特殊处理
|
|
null != LevelManager.Instance.CurrentLevel &&
|
|
100002 == LevelManager.Instance.CurrLevel.Cfg.Id &&
|
|
owner is Character.Character character &&
|
|
100003 == character.ConfigId) // 克劳迪亚
|
|
{
|
|
if (chargeLogic is SkillChargeTime timeLogic)
|
|
{
|
|
timeLogic.ForceFullCharge();
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
public void LogicUpdate(float dt)
|
|
{
|
|
// var scale = owner.fightData.skillCdReduceScale;
|
|
// runtimeData.remainCDTime -= dt * scale;
|
|
|
|
chargeLogic.TriggerTimeChange(dt);
|
|
}
|
|
|
|
public void TriggerNormalAttack()
|
|
{
|
|
chargeLogic.TriggerNormalAttack();
|
|
}
|
|
|
|
public void TriggerBeAttack()
|
|
{
|
|
chargeLogic.TriggerBeAttack();
|
|
}
|
|
|
|
public void ReduceSkillCd(float reduceTime)
|
|
{
|
|
if (chargeLogic is SkillChargeTime timeLogic)
|
|
{
|
|
timeLogic.AddPassTime(reduceTime);
|
|
}
|
|
}
|
|
|
|
public void ReduceSkillCdPercent(float reducePercent)
|
|
{
|
|
if (chargeLogic is SkillChargeTime timeLogic)
|
|
{
|
|
timeLogic.AddPassTime(timeLogic.rawConfig.ChargeParam * reducePercent);
|
|
}
|
|
}
|
|
|
|
public void Use(int targetCellIndex)
|
|
{
|
|
if (!canRelease)
|
|
{
|
|
DebugUtil.LogError("技能未准备好或者CD未冷却");
|
|
return;
|
|
}
|
|
DebugUtil.LogG($"owner:{owner.GetUnitDesc()} 释放技能:{runtimeData.configData.ID} {runtimeData.configData.NameRead} 目标:{targetCellIndex}");
|
|
owner._UseSkill(targetCellIndex, this);
|
|
|
|
if (!CodeDefine.Fight.SkipSkillCDCheck)
|
|
{
|
|
chargeLogic.TriggerUse();
|
|
}
|
|
|
|
if (owner.debugShowInfo.cacheConfigId != 0)
|
|
{
|
|
EventManager.Instance.Send(EventManager.EventName.INFIGHT_AUDIO_USE_SKILL, owner.debugShowInfo.cacheConfigId);
|
|
}
|
|
}
|
|
|
|
public void TriggerSkillEnd()
|
|
{
|
|
// 技能结束时触发,重置技能CD
|
|
|
|
}
|
|
}
|
|
}
|