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

49 lines
1.0 KiB
C#
Raw Normal View History

2023-08-22 19:08:45 +08:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
2023-10-19 15:00:19 +08:00
using Gameplay.Common;
2023-08-22 19:08:45 +08:00
namespace Gameplay.Skill
{
using cfg.SkillCfg;
2023-10-19 15:00:19 +08:00
using Character;
2023-08-22 19:08:45 +08:00
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-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)
{
runtimeData.remainCDTime = runtimeData.configData.CDTime;
owner.UseSkill(targetCellIndex, this);
}
}
}