|
@@ -38,7 +38,7 @@ export class LevelAction extends Component {
|
|
}
|
|
}
|
|
|
|
|
|
start() {
|
|
start() {
|
|
- // this.generateInitialCups();
|
|
|
|
|
|
+ this.generateInitialCups();
|
|
this.registerListener();
|
|
this.registerListener();
|
|
}
|
|
}
|
|
|
|
|
|
@@ -412,6 +412,7 @@ export class LevelAction extends Component {
|
|
// 设置初始位置(屏幕左侧)
|
|
// 设置初始位置(屏幕左侧)
|
|
const uiTransform = this.node.getComponent(UITransform)!;
|
|
const uiTransform = this.node.getComponent(UITransform)!;
|
|
newCup.setPosition(-uiTransform.width / 2, 0, 0);
|
|
newCup.setPosition(-uiTransform.width / 2, 0, 0);
|
|
|
|
+ newCup.getComponent(OriginCup)!.cupHeight = height;
|
|
this.goblets.addChild(newCup);
|
|
this.goblets.addChild(newCup);
|
|
|
|
|
|
// 记录新杯子的初始位置
|
|
// 记录新杯子的初始位置
|
|
@@ -442,8 +443,8 @@ export class LevelAction extends Component {
|
|
const originCup = cupNode.getComponent(OriginCup)!;
|
|
const originCup = cupNode.getComponent(OriginCup)!;
|
|
const waters = originCup.waters.children;
|
|
const waters = originCup.waters.children;
|
|
|
|
|
|
- // 暂时写死5层水
|
|
|
|
- const waterCount = 5;
|
|
|
|
|
|
+ // console.log(`新创建原浆杯,高度: ${originCup.cupHeight}`);
|
|
|
|
+ const waterCount = originCup.cupHeight;
|
|
for (let i = 0; i < waterCount; i++) {
|
|
for (let i = 0; i < waterCount; i++) {
|
|
const waterNode = waters[i];
|
|
const waterNode = waters[i];
|
|
if (!waterNode) continue;
|
|
if (!waterNode) continue;
|