|
@@ -278,7 +278,7 @@ export class LevelAction extends Component {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- // 修改原有方法,在添加新杯子后触发暂存区倒水
|
|
|
|
|
|
+ // 在添加新杯子后触发暂存区倒水
|
|
private async addWaitCupToOutArea() {
|
|
private async addWaitCupToOutArea() {
|
|
// 原有添加逻辑保持不变
|
|
// 原有添加逻辑保持不变
|
|
const waitCups = this.waitArea.cups;
|
|
const waitCups = this.waitArea.cups;
|
|
@@ -314,14 +314,22 @@ export class LevelAction extends Component {
|
|
newCups.forEach(cup => cup.setParent(outNodes));
|
|
newCups.forEach(cup => cup.setParent(outNodes));
|
|
|
|
|
|
// 执行统一平移
|
|
// 执行统一平移
|
|
- this.outArea.getCups().concat(this.waitArea.getCups()).forEach(cup => {
|
|
|
|
- tween(cup)
|
|
|
|
- .by(0.3, { position: new Vec3(80, 0, 0) }, { easing: 'sineOut' })
|
|
|
|
- .start();
|
|
|
|
- });
|
|
|
|
|
|
+ if (this.waitArea.getCups().length > 0) {
|
|
|
|
+ this.outArea.getCups().concat(this.waitArea.getCups()).forEach(cup => {
|
|
|
|
+ tween(cup)
|
|
|
|
+ .by(0.3, { position: new Vec3(80, 0, 0) }, { easing: 'sineOut' })
|
|
|
|
+ .start();
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
|
|
// 在添加完成后处理暂存区倒水
|
|
// 在添加完成后处理暂存区倒水
|
|
await this.handlePourTempCupToOutArea();
|
|
await this.handlePourTempCupToOutArea();
|
|
|
|
+
|
|
|
|
+ // 胜利条件检测:当两个区域都没有杯子时触发胜利
|
|
|
|
+ if (this.outArea.getCups().length === 0 && this.waitArea.cups.length === 0) {
|
|
|
|
+ this.isProcessing = true;
|
|
|
|
+ console.log('Game Victory!');
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
private async pourAnimation(
|
|
private async pourAnimation(
|
|
@@ -372,6 +380,10 @@ export class LevelAction extends Component {
|
|
}
|
|
}
|
|
|
|
|
|
private async spawnNewOriginCup(targetPos: Vec3) {
|
|
private async spawnNewOriginCup(targetPos: Vec3) {
|
|
|
|
+ // DOTO 获取颜色配置
|
|
|
|
+ const colors = this.getAvailableColors(5); // 获取前5个颜色
|
|
|
|
+ if (colors.length <= 0) return;
|
|
|
|
+
|
|
// 创建新原浆杯
|
|
// 创建新原浆杯
|
|
const height = TakeGobletGlobalInstance.instance.generateOriginCupHeight();
|
|
const height = TakeGobletGlobalInstance.instance.generateOriginCupHeight();
|
|
const prefab = await TakeGobletGlobalInstance.instance.loadAsyncOriginCup(height);
|
|
const prefab = await TakeGobletGlobalInstance.instance.loadAsyncOriginCup(height);
|
|
@@ -390,8 +402,6 @@ export class LevelAction extends Component {
|
|
.to(0.5, { position: targetPos })
|
|
.to(0.5, { position: targetPos })
|
|
.start();
|
|
.start();
|
|
|
|
|
|
- // DOTO 获取颜色配置
|
|
|
|
- const colors = this.getAvailableColors(5); // 获取前5个颜色
|
|
|
|
this.setupOriginCupColors(newCup, colors);
|
|
this.setupOriginCupColors(newCup, colors);
|
|
}
|
|
}
|
|
|
|
|