去掉碰撞系统
This commit is contained in:
55
assets/script/game/skill/SkillAnimation.ts
Normal file
55
assets/script/game/skill/SkillAnimation.ts
Normal file
@@ -0,0 +1,55 @@
|
||||
import { ecs ,} from "db://oops-framework/libs/ecs/ECS";
|
||||
import { HeroViewComp } from "../hero/HeroViewComp";
|
||||
import { SkillsComp } from "./SkillSystem";
|
||||
import { SkillSet } from "../common/config/SkillSet";
|
||||
import { Node } from "cc";
|
||||
|
||||
// 动画组件
|
||||
@ecs.register('SkillAnimation')
|
||||
export class SkillAnimationComp extends ecs.Comp {
|
||||
prefab: Node | null = null; // 预制体实例
|
||||
damageTriggerTime = 0.3; // 伤害触发时间(秒)
|
||||
elapsed = 0; // 已播放时间
|
||||
|
||||
reset() {
|
||||
this.prefab?.destroy();
|
||||
this.prefab = null;
|
||||
this.damageTriggerTime = 0.3;
|
||||
this.elapsed = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// 动画系统
|
||||
@ecs.register('SkillAnimationSystem')
|
||||
export class SkillAnimationSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate {
|
||||
filter(): ecs.IMatcher {
|
||||
return ecs.allOf(SkillAnimationComp, HeroViewComp);
|
||||
}
|
||||
|
||||
update(e: ecs.Entity): void {
|
||||
const anim = e.get(SkillAnimationComp);
|
||||
anim.elapsed += this.dt;
|
||||
|
||||
// 伤害触发检测
|
||||
// if (!anim.hitted && anim.elapsed >= anim.hitTime) {
|
||||
// this.applyDamage(e);
|
||||
// anim.hitted = true;
|
||||
// }
|
||||
|
||||
// 更新动画状态
|
||||
// if (anim.elapsed >= anim.duration) {
|
||||
// e.remove(SkillAnimationComp);
|
||||
// }
|
||||
}
|
||||
|
||||
private applyDamage(e: ecs.Entity) {
|
||||
const skill = e.get(SkillsComp);
|
||||
const view = e.get(HeroViewComp);
|
||||
|
||||
// 添加伤害标记组件
|
||||
|
||||
}
|
||||
|
||||
// 在角色组件中实现目标查找
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user