DaFuWeng/assets/GlobalScript/Animation/AnimationNode.ts

29 lines
620 B
TypeScript

/*
* @Author: WoNiu
* @Date: 2024-03-11 12:16:36
* @LastEditTime: 2024-03-26 15:40:23
* @LastEditors: WoNiu
* @Description:
*/
import { _decorator, Node } from 'cc';
import { ScriptMyAnimation } from './ScriptMyAnimation';
const { ccclass } = _decorator;
@ccclass('AnimationNode')
export class AnimationNode extends Node{
constructor(AnimationPath: string,aniDone?:Function) {
super();
let aniNode = new Node();
let ani = aniNode.addComponent( ScriptMyAnimation)
ani.AnimationPath = AnimationPath;
ani.onAniDone = aniDone;
this.addChild(aniNode);
}
}