|
@@ -308,6 +308,11 @@ export class LevelAction extends Component {
|
|
|
originCup.hideCurrentWaterLayer();
|
|
|
}
|
|
|
|
|
|
+ this.checkGameOver();
|
|
|
+
|
|
|
+ const { isEnd } = LevelManager.instance.levelModel;
|
|
|
+ if (isEnd) return;
|
|
|
+
|
|
|
// 处理完所有颜色后检查剩余水层
|
|
|
if (!originCup.waters) return
|
|
|
const remaining = originCup.waters.children.filter(n => n.active).length;
|
|
@@ -429,7 +434,6 @@ export class LevelAction extends Component {
|
|
|
|
|
|
//游戏检测胜利或失败
|
|
|
checkGameOver() {
|
|
|
- if (this.isProcessing) return;
|
|
|
// 胜利条件检测:当两个区域都没有杯子时触发胜利
|
|
|
if (this.outArea.getCups().length === 0 && this.waitArea.cups.length === 0) {
|
|
|
this.loadResultPanel(true);
|
|
@@ -445,6 +449,7 @@ export class LevelAction extends Component {
|
|
|
//加载结算面板
|
|
|
loadResultPanel(win: boolean) {
|
|
|
this.isProcessing = true;
|
|
|
+ LevelManager.instance.levelModel.isEnd = true;
|
|
|
if (!win) {
|
|
|
const waitLength = this.waitArea!.getCups().length;
|
|
|
const outLength = this.outArea!.getCups().length;
|
|
@@ -475,17 +480,17 @@ export class LevelAction extends Component {
|
|
|
const targetWorldPos = target.getWorldPosition().clone();
|
|
|
const tempRegex = /TempCup/.test(origin.name);
|
|
|
|
|
|
- let targetPosY: number = 135;
|
|
|
+ let targetPosY: number = 150;
|
|
|
if (origin.getComponent(OriginCup)) {
|
|
|
const targetCup = origin.getComponent(OriginCup)!;
|
|
|
if (targetCup.cupHeight == CupHeight.Two) {
|
|
|
- targetPosY = 165;
|
|
|
+ targetPosY = 180;
|
|
|
} else if (targetCup.cupHeight == CupHeight.Four) {
|
|
|
- targetPosY = 105;
|
|
|
+ targetPosY = 120;
|
|
|
}
|
|
|
}
|
|
|
// 调整偏移量
|
|
|
- targetWorldPos.x -= !tempRegex ? 55 : 40;
|
|
|
+ targetWorldPos.x -= !tempRegex ? 45 : 40;
|
|
|
targetWorldPos.y += !tempRegex ? targetPosY : 205;
|
|
|
|
|
|
// 移动动画到目标位置
|