|
|
@@ -124,6 +124,7 @@ export class SlotGame extends Component {
|
|
|
private turboBtn!: Node; private autoBtn!: Node;
|
|
|
private bossNode: Node | null = null;
|
|
|
private bossSk: sp.Skeleton | null = null;
|
|
|
+ private bossBusy = false;
|
|
|
|
|
|
onLoad() {
|
|
|
try { (cc as any).profiler?.hideStats?.(); } catch (e) {}
|
|
|
@@ -221,6 +222,7 @@ export class SlotGame extends Component {
|
|
|
node.setScale(scale, scale, 1);
|
|
|
node.setPosition(this.frameW * 0.40, this.frameCY + this.frameH * 0.32, 0);
|
|
|
this.bossNode = node; this.bossSk = sk;
|
|
|
+ this.schedule(() => this.bossIdleBeat(), 3.2);
|
|
|
}
|
|
|
|
|
|
// ---------------- HUD:用 hud_pill 美术 ----------------
|
|
|
@@ -364,30 +366,60 @@ export class SlotGame extends Component {
|
|
|
this.coinShower(Math.max(12, Math.min(40, Math.floor(amount / 15))));
|
|
|
}
|
|
|
|
|
|
- private bossDefeated() {
|
|
|
+ private playBossAnim(name: string, loop = false) {
|
|
|
if (!this.bossNode || !this.bossSk) return;
|
|
|
- this.bossSk.setAnimation(0, 'hurt', false);
|
|
|
- this.bossSk.addAnimation(0, 'explode', false, 0.08);
|
|
|
- this.bossSk.addAnimation(0, 'idle', true, 0.3);
|
|
|
+ try { this.bossSk.setAnimation(0, name, loop); }
|
|
|
+ catch (e) { try { this.bossSk.setAnimation(0, 'idle', true); } catch (_e) {} }
|
|
|
+ }
|
|
|
+
|
|
|
+ private addBossAnim(name: string, loop = false, delay = 0) {
|
|
|
+ if (!this.bossSk) return;
|
|
|
+ try { this.bossSk.addAnimation(0, name, loop, delay); } catch (e) {}
|
|
|
+ }
|
|
|
+
|
|
|
+ private bossIdleBeat() {
|
|
|
+ if (!this.bossNode || !this.bossSk || this.spinning || this.bossBusy) return;
|
|
|
+ const anim = Math.random() > 0.5 ? 'watch' : 'charge';
|
|
|
+ this.playBossAnim(anim, false);
|
|
|
+ this.addBossAnim('idle', true, 0);
|
|
|
+ const n = this.bossNode;
|
|
|
+ const base = n.scale.x;
|
|
|
+ tween(n).to(0.25, { scale: new Vec3(base * 1.04, base * 0.98, 1) })
|
|
|
+ .to(0.28, { scale: new Vec3(base, base, 1) }).start();
|
|
|
+ }
|
|
|
+
|
|
|
+ private bossDefeated(amount: number) {
|
|
|
+ if (!this.bossNode || !this.bossSk) return;
|
|
|
+ this.bossBusy = true;
|
|
|
+ this.playBossAnim('coin_throw', false);
|
|
|
+ this.addBossAnim('hurt', false, 0.05);
|
|
|
+ this.addBossAnim('explode', false, 0.08);
|
|
|
+ this.addBossAnim('idle', true, 0.35);
|
|
|
this.playParticle('boss_explosion');
|
|
|
+ this.coinShower(Math.max(10, Math.min(34, Math.floor(amount / 20))));
|
|
|
const n = this.bossNode;
|
|
|
const base = n.scale.x;
|
|
|
tween(n).to(0.10, { scale: new Vec3(base * 1.18, base * 0.86, 1), angle: -7 })
|
|
|
.to(0.12, { scale: new Vec3(base * 0.82, base * 1.18, 1), angle: 8 })
|
|
|
- .to(0.18, { scale: new Vec3(base, base, 1), angle: 0 }, { easing: 'backOut' }).start();
|
|
|
- this.flashMult('大魔王裂开爆炸!');
|
|
|
+ .to(0.18, { scale: new Vec3(base, base, 1), angle: 0 }, { easing: 'backOut' })
|
|
|
+ .call(() => { this.bossBusy = false; }).start();
|
|
|
+ this.flashMult('大魔王撒币后裂开爆炸!');
|
|
|
}
|
|
|
|
|
|
private bossTaunt() {
|
|
|
if (!this.bossNode || !this.bossSk) return;
|
|
|
- this.bossSk.setAnimation(0, 'taunt', false);
|
|
|
- this.bossSk.addAnimation(0, 'idle', true, 0);
|
|
|
+ this.bossBusy = true;
|
|
|
+ this.playBossAnim('taunt', false);
|
|
|
+ this.addBossAnim('stomp', false, 0.04);
|
|
|
+ this.addBossAnim('attack', false, 0.02);
|
|
|
+ this.addBossAnim('idle', true, 0);
|
|
|
const n = this.bossNode;
|
|
|
const x = n.position.x, y = n.position.y;
|
|
|
tween(n).to(0.12, { position: new Vec3(x - this.cell * 0.12, y + this.cell * 0.10, 0), angle: -5 })
|
|
|
.to(0.16, { position: new Vec3(x + this.cell * 0.10, y - this.cell * 0.18, 0), angle: 7 })
|
|
|
- .to(0.18, { position: new Vec3(x, y, 0), angle: 0 }, { easing: 'backOut' }).start();
|
|
|
- this.flashMult('大魔王举剑耀武扬威');
|
|
|
+ .to(0.18, { position: new Vec3(x, y, 0), angle: 0 }, { easing: 'backOut' })
|
|
|
+ .call(() => { this.bossBusy = false; }).start();
|
|
|
+ this.flashMult('大魔王举剑踩踏耀武扬威');
|
|
|
}
|
|
|
private coinShower(count: number) {
|
|
|
const sf = this.art['coin']; if (!sf) return;
|
|
|
@@ -680,7 +712,7 @@ export class SlotGame extends Component {
|
|
|
}
|
|
|
|
|
|
private endRound() {
|
|
|
- if (this.roundWin > 0) { this.multLabel.string = ''; this.celebrate(this.roundWin); this.bossDefeated(); }
|
|
|
+ if (this.roundWin > 0) { this.multLabel.string = ''; this.celebrate(this.roundWin); this.bossDefeated(this.roundWin); }
|
|
|
else { this.multLabel.string = ''; this.bossTaunt(); }
|
|
|
this.spinning = false; this.setSpinEnabled(true);
|
|
|
if (this.holdActive) return;
|