This commit is contained in:
2025-02-07 20:26:25 +08:00
parent f5fe35d36b
commit 8a6609f2c2

View File

@@ -1,3 +1,26 @@
/**
* 这是一个 使用cocos creator 3.8.2引擎 开发的游戏英雄技能系统TS脚本
* SkillSet 技能配置表
* HeroViewComp 英雄视图组件
* HeroSkillsComp 英雄技能组件
* Skill 技能实体
* SkillCom 技能视图组件
* 目前实现功能:
* 1. 技能冷却
* 2. 技能释放
* 3. 技能目标选择
* 4. 基础攻击技能的伤害应用 及view的伤害显示
* 未完成功能
* 1. 技能的动画显示和运动
* 2. debuff技能的实现和动画显示
* 3. buff技能实现和动画显示
*/
import { Node, Vec3 } from "cc";
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
import { HeroViewComp } from "../hero/HeroViewComp";
@@ -6,13 +29,15 @@ import { SkillSet, TargetGroup, TargetType } from "../common/config/SkillSet";
import { CdType } from "../common/config/SkillSet";
import { oops } from "db://oops-framework/core/Oops";
import { GameEvent } from "../common/config/GameEvent";
import { Skill } from "../skills/Skill";
import { SkillCom } from "../skills/SkillCom";
/** 技能系统 */
@ecs.register('HeroSkillSystem')
export class HeroSkillSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate {
private updateInterval: number = 0.1; // 每0.1秒更新一次
private accumulator: number = 0;
// private updateInterval: number = 0.1; // 每0.1秒更新一次
// private accumulator: number = 0;
private _timers: { [key: string]: number } = {};
init(): void {
oops.message.on(GameEvent.MissionEnd, this.clear_timer, this);
@@ -56,7 +81,7 @@ export class HeroSkillSystem extends ecs.ComblockSystem implements ecs.ISystemUp
private updateCooldown(comp: HeroSkillsComp, skillId: number) {
let cd = comp.cooldowns.has(skillId) ? comp.cooldowns.get(skillId)! : 0;
if (cd > 0) {
comp.cooldowns.set(skillId, cd - this.updateInterval);
comp.cooldowns.set(skillId, cd - this.dt);
}
}