技能系统 初步搭建,下步 伤害系统

This commit is contained in:
2025-02-03 01:07:56 +08:00
parent 2e53786aa0
commit 5536428125
15 changed files with 465 additions and 846 deletions

View File

@@ -1,10 +1,31 @@
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
@ecs.register('HeroSkills')
export class HeroSkillsComp extends ecs.Comp {
/** 移动方向1向右-1向左 */
/** 当前拥有的技能ID列表 */
skills: number[] = [];
/** 技能冷却计时器 [技能ID:剩余冷却时间] */
cooldowns: Map<number, number> = new Map();
/** 技能触发计数器 [技能ID:触发次数] */
counters: Map<number, number> = new Map();
reset() {
this.skills = [];
this.cooldowns.clear();
this.counters.clear();
}
/** 重置指定技能冷却 */
resetCooldown(skillId: number) {
if (this.cooldowns.has(skillId)) {
this.cooldowns.set(skillId, 0);
}
}
/** 重置所有技能冷却 */
resetAllCooldowns() {
this.cooldowns.forEach((value, key) => {
this.cooldowns.set(key, 0);
});
}
}