Files
pixelheros/assets/script/game/Boss/BossSpine.ts
walkpan 618a6e3f7b dd
2024-09-23 08:14:39 +08:00

57 lines
1.7 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/*
* @Author: dgflash
* @Date: 2022-08-04 15:08:35
* @LastEditors: dgflash
* @LastEditTime: 2022-08-04 15:26:26
*/
import { Color, Component, EventTouch, sp, Vec3, _decorator ,Animation, AnimationClip, AnimationState} from "cc";
import { LayerUtil } from "../../../../extensions/oops-plugin-framework/assets/core/utils/LayerUtil";
import { smc } from "../common/SingletonModuleComp";
const { ccclass, property } = _decorator;
/**
* SPINE角色模型
*/
@ccclass('BossSpine')
export class BossSpine extends Component {
private loop: boolean = true;
private spine!: sp.Skeleton;
private default:string = "idle";
private atk_name: string = "atk";
private move_name: string = "move";
private max_name: string = "atk";
private idel_name: string = "move";
start() {
this.spine.setAnimation(0, this.default, true);
}
mixTime:number= 0.2;
onLoad() {
this.spine = this.node.getChildByName("anm")!.getComponent(sp.Skeleton);
this.spine.setEndListener(trackEntry => {
var animationName = trackEntry.animation ? trackEntry.animation.name : "";
// console.log("[track %s][animation %s] end.", trackEntry.trackIndex, animationName);
if (animationName == "atk" || animationName== "max" ) {
this.spine.setAnimation(0, this.default, true);
}
});
}
protected play(animName: string, loop: boolean) {
}
atk(){
this.spine.setAnimation(0, this.atk_name, false);
}
idle(){
this.spine.setAnimation(0, this.idel_name, true);
}
move(){
this.spine.setAnimation(0, this.move_name, true);
}
max(){
this.spine.setAnimation(0, this.max_name, false);
}
}