import { _decorator, Animation, Component, Node } from 'cc'; import { SkillCom } from './SkillCom'; import { SkillSet } from '../common/config/SkillSet'; import { ecs } from 'db://oops-framework/libs/ecs/ECS'; import { Skill } from './Skill'; const { ccclass, property } = _decorator; @ccclass('seCom') export class seCom extends Component { base:SkillCom = null start() { this.base =this.node.getComponent(SkillCom) if(this.node.getComponent(Animation)){ let anim = this.node.getComponent(Animation); console.log("has anim",anim) anim.on(Animation.EventType.FINISHED, this.onAnimationFinished, this); } if(this.node.getChildByName('anm')){ if(this.node.getChildByName('anm').getComponent('sp.Skeleton')){ var spine = this.node.getChildByName('anm').getComponent('sp.Skeleton') as sp.Skeleton; console.log("has spine",spine) spine.setCompleteListener((trackEntry) => { this.onAnimationFinished() console.log("[track %s][animation %s] complete: %s", trackEntry.trackIndex); }); } } } update(deltaTime: number) { } onAnimationFinished(){ let skill = ecs.getEntity(Skill); this.base.to_console("=>技能二段触发=>"+SkillSet[this.base.s_uuid].sonsk) skill.load(this.node.position,this.base.box_group,this.base.node,SkillSet[this.base.s_uuid].sonsk,this.base.ap,this.base.t_pos,this.base.is_crit,this.base.crit_add); this.base.is_destroy=true } }