boss需要改用spine 动画 先放一放
This commit is contained in:
56
assets/script/game/Boss/BossSpine.ts
Normal file
56
assets/script/game/Boss/BossSpine.ts
Normal file
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* @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;
|
||||
|
||||
/**
|
||||
* RPG 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 = "max";
|
||||
private idel_name: string = "idle";
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user