refactor(skill): 优化特效生命周期管理并添加新动画

- 移除 timedCom 组件中未使用的 cd 和 ap 属性
- 重命名 dead 组件为 oneCom 并重构动画结束销毁逻辑,避免内存泄漏
- 为部分技能添加准备动画(readyAnm)配置
- 新增 uplv 升级动画特效预制体
- 统一特效生成接口,支持基于动画结束或定时销毁两种模式
- 清理 HeroViewComp 中未使用的导入和方法
This commit is contained in:
panw
2026-03-19 14:40:51 +08:00
parent 2a4a9cbe3f
commit 0f6ab4a775
6 changed files with 51 additions and 43 deletions

View File

@@ -1,18 +1,29 @@
import { _decorator, Component, Node ,Animation} from 'cc';
const { ccclass, property } = _decorator;
import { _decorator, Component, Animation } from 'cc';
const { ccclass } = _decorator;
@ccclass('oneCom')
export class oneCom extends Component {
private anim: Animation | null = null;
@ccclass('dead')
export class dead extends Component {
start() {
let anim = this.node.getComponent(Animation);
anim.on(Animation.EventType.FINISHED, this.onAnimationFinished, this);
this.anim = this.node.getComponent(Animation);
if (!this.anim) {
this.node.destroy();
return;
}
this.anim.off(Animation.EventType.FINISHED, this.onAnimationFinished, this);
this.anim.on(Animation.EventType.FINISHED, this.onAnimationFinished, this);
}
onAnimationFinished(){
onDestroy() {
if (!this.anim) return;
this.anim.off(Animation.EventType.FINISHED, this.onAnimationFinished, this);
this.anim = null;
}
onAnimationFinished() {
this.node.destroy();
}
update(deltaTime: number) {
}
}

View File

@@ -6,8 +6,6 @@ const { ccclass, property } = _decorator;
@ccclass('timedCom')
export class timedCom extends Component {
time = 0.3;
cd: number = 0;
ap: number = 0;
start() {