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.
32 lines
749 B
32 lines
749 B
|
1 week ago
|
import { _decorator, Component, Node, sp } from 'cc';
|
||
|
|
import { SuDacePlayer } from './SuDacePlayer';
|
||
|
|
import { SuDace } from './SuDace';
|
||
|
|
const { ccclass, property } = _decorator;
|
||
|
|
|
||
|
|
@ccclass('SuDaceBox')
|
||
|
|
export class SuDaceBox extends Component {
|
||
|
|
|
||
|
|
|
||
|
|
att = [0.5, 0.3, 0.5, 0.5];
|
||
|
|
|
||
|
|
start() {
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
update(deltaTime: number) {
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
openBox(player: SuDacePlayer) {
|
||
|
|
let index = Math.floor(Math.random() * this.att.length);
|
||
|
|
player.addAttr(index, this.att[index]);
|
||
|
|
this.node.getComponentInChildren(sp.Skeleton).setAnimation(0, "play", false);
|
||
|
|
this.node.getComponentInChildren(sp.Skeleton).setCompleteListener(() => {
|
||
|
|
this.node.destroy();
|
||
|
|
});
|
||
|
|
SuDace.instance.playOpen();
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
|