动画重做,需要修改
This commit is contained in:
50
assets/script/game/hero/HeroAnmComp.ts
Normal file
50
assets/script/game/hero/HeroAnmComp.ts
Normal file
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* @Author: dgflash
|
||||
* @Date: 2022-08-04 15:08:35
|
||||
* @LastEditors: dgflash
|
||||
* @LastEditTime: 2022-08-04 15:26:38
|
||||
*/
|
||||
import { sp, _decorator } from "cc";
|
||||
import AnimatorSpine from "../../../../extensions/oops-plugin-framework/assets/libs/animator/AnimatorSpine";
|
||||
|
||||
const { ccclass, property, requireComponent, disallowMultiple } = _decorator;
|
||||
|
||||
/**
|
||||
* Spine状态机组件(主状态机),trackIndex为0
|
||||
*/
|
||||
@ccclass
|
||||
@disallowMultiple
|
||||
@requireComponent(sp.Skeleton)
|
||||
export default class HeroAnmComp extends AnimatorSpine {
|
||||
|
||||
private animName: string = "Idle";
|
||||
private loop: boolean = true;
|
||||
|
||||
start() {
|
||||
|
||||
super.start();
|
||||
}
|
||||
|
||||
lateUpdate(dt: number) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 播放动画
|
||||
* @override
|
||||
* @param animName 动画名
|
||||
* @param loop 是否循环播放
|
||||
*/
|
||||
protected playAnimation(animName: string, loop: boolean) {
|
||||
if (animName) {
|
||||
this.animName = animName;
|
||||
this.loop = loop;
|
||||
|
||||
this._spine.setAnimation(0, animName, loop);
|
||||
}
|
||||
else {
|
||||
this._spine.clearTrack(0);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user