技能组件修改,由skillcom统一负责动画,只负责动画

This commit is contained in:
2025-02-08 08:06:42 +08:00
parent 8a6609f2c2
commit c619b97aa4
47 changed files with 450 additions and 555 deletions

View File

@@ -105,7 +105,9 @@ export class HeroSkillSystem extends ecs.ComblockSystem implements ecs.ISystemUp
private castSkill(caster: ecs.Entity, skillId: number, config: typeof SkillSet[keyof typeof SkillSet]) {
const view = caster.get(HeroViewComp);
const comp = caster.get(HeroSkillsComp);
console.log(view.hero_name+"施放技能:"+config.uuid+"=>"+view.hero_name)
console.log(view.hero_name+"施放技能:"+config.uuid+"=>"+view.hero_name);
// 处理CD和消耗
switch(config.CdType) {
case CdType.SkillCD:
view.as.max()
@@ -124,17 +126,22 @@ export class HeroSkillSystem extends ecs.ComblockSystem implements ecs.ISystemUp
// 选择目标
const targets = this.selectTargets(caster, config);
if (targets.length === 0) return;
// 创建技能实体
const skillEntity = ecs.getEntity<Skill>(Skill);
skillEntity.load(
view.node.position, // 起始位置
view.fac, // 阵营
view.node.parent, // 父节点
config.uuid, // 技能ID
targets[0]?.get(HeroViewComp).node.position // 目标位置
);
// 应用技能效果
targets.forEach(target => {
this.applySkillEffect(caster, target, config);
});
// 重置计数器
if (config.count) {
comp.counters.set(skillId, (comp.counters.get(skillId) || 0) + 1);
}
// 触发技能动画等表现
}
/** 选择技能目标 */