You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
1.1 KiB
40 lines
1.1 KiB
|
1 week ago
|
import { _decorator, Component, director, Node, sp } from 'cc';
|
||
|
|
const { ccclass, property } = _decorator;
|
||
|
|
|
||
|
|
@ccclass('jige')
|
||
|
|
export class jige extends Component {
|
||
|
|
|
||
|
|
anim: sp.Skeleton = null;
|
||
|
|
|
||
|
|
|
||
|
|
protected onLoad(): void {
|
||
|
|
this.anim = this.node.getChildByName('amin').getComponent(sp.Skeleton);
|
||
|
|
}
|
||
|
|
|
||
|
|
protected onEnable(): void {
|
||
|
|
this.anim.setAnimation(0, '常态待机', true);
|
||
|
|
}
|
||
|
|
|
||
|
|
protected update(dt: number): void {
|
||
|
|
// if (director.getTotalFrames() % 180 === 0 && this.anim.animation === '常态待机') {
|
||
|
|
// this.anim.setAnimation(0, '待机', false);
|
||
|
|
// this.anim.setCompleteListener(() => {
|
||
|
|
// this.anim.setAnimation(0, '常态待机', true);
|
||
|
|
// this.anim.setCompleteListener(null);
|
||
|
|
// });
|
||
|
|
// }
|
||
|
|
}
|
||
|
|
|
||
|
|
/**播放得意动画 */
|
||
|
|
playHappyAnim() {
|
||
|
|
console.log('playHappyAnim得意');
|
||
|
|
this.anim.setAnimation(0, '得意', false);
|
||
|
|
this.anim.setCompleteListener(() => {
|
||
|
|
this.anim.setAnimation(0, '常态待机', true);
|
||
|
|
this.anim.setCompleteListener(null);
|
||
|
|
});
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
|