|
@@ -30,6 +30,7 @@ export class LevelAction extends Component {
|
|
|
private originCupPositions = new Map<string, Vec3>(); // 改用唯一ID记录
|
|
|
|
|
|
start() {
|
|
|
+ this.originCupPositions.clear();
|
|
|
this.generateInitialCups();
|
|
|
this.registerListener();
|
|
|
}
|
|
@@ -41,6 +42,7 @@ export class LevelAction extends Component {
|
|
|
registerListener() {
|
|
|
EventDispatcher.instance.on(GameEvent.EVENT_CLICK_ORIGIN_CUP, this.handlePourOriginCup, this);
|
|
|
EventDispatcher.instance.on(GameEvent.EVENT_ORIGIN_CUP_DESTROYED, (uuid: string) => {
|
|
|
+ if (!this.originCupPositions) return
|
|
|
const targetPos = this.originCupPositions.get(uuid);
|
|
|
if (targetPos) {
|
|
|
this.spawnNewOriginCup(targetPos);
|