This commit is contained in:
2024-08-18 23:38:55 +08:00
parent e8dbb9bab3
commit 8f57f57c1d
1004 changed files with 234067 additions and 16087 deletions

View File

@@ -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) {