dd
This commit is contained in:
@@ -16,23 +16,30 @@ const { ccclass, property, requireComponent, disallowMultiple } = _decorator;
|
||||
@disallowMultiple
|
||||
@requireComponent(sp.Skeleton)
|
||||
export default class RoleSpineAnimator extends Component {
|
||||
private animName: string = "idle";
|
||||
private animName: string = "move";
|
||||
private loop: boolean = true;
|
||||
private spine!: sp.Skeleton;
|
||||
mixTime:number= 0.2;
|
||||
|
||||
protected onLoad(): void {
|
||||
this.spine = this.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 == "magic") {
|
||||
this.spine.setAnimation(0, "move", true);
|
||||
}
|
||||
});
|
||||
}
|
||||
start() {
|
||||
this.spine = this.getComponent(sp.Skeleton)!;
|
||||
console.log("RoleSpineAnimator start smc.heros",smc.heros);
|
||||
|
||||
this.playAnimation(this.animName, this.loop);
|
||||
|
||||
}
|
||||
|
||||
lateUpdate(dt: number) {
|
||||
|
||||
}
|
||||
getRandomInt(min: number, max: number): number {
|
||||
min = Math.ceil(min);
|
||||
max = Math.floor(max);
|
||||
return Math.floor(Math.random() * (max - min + 1)) + min;
|
||||
}
|
||||
|
||||
play(animName: string, loop: boolean) {
|
||||
if (animName) {
|
||||
|
||||
Reference in New Issue
Block a user