Skip to content

Commit

Permalink
Fix end of day overlay not opening
Browse files Browse the repository at this point in the history
  • Loading branch information
Golen87 committed Aug 17, 2024
1 parent f3c08a5 commit 1528da6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
1 change: 0 additions & 1 deletion src/components/Station.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ export class Station extends Button {

setClickable(value: boolean) {
this.sprite.input!.enabled = value;
console.log("SET CLICKABLE", value);
}

upgrade() {
Expand Down
12 changes: 7 additions & 5 deletions src/scenes/GameScene.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export class GameScene extends BaseScene {
public day: number = 0;
public dayDuration: number = 60000; // 1 minute
public timeOfDay: number = 0;
public money: number = 500;
public money: number = 0;

constructor() {
super({ key: "GameScene" });
Expand Down Expand Up @@ -79,6 +79,7 @@ export class GameScene extends BaseScene {
this.ui = new UI(this);
this.ui.setDepth(1000);
this.ui.setMoney(this.money);
this.ui.setDay(this.day);
this.ui.on("nextDay", () => {
this.startDay();
});
Expand Down Expand Up @@ -120,8 +121,8 @@ export class GameScene extends BaseScene {
loop: true,
});

this.setState(GameState.Shopping);
// this.startDay();
// this.setState(GameState.Shopping);
this.startDay();
}

update(time: number, delta: number) {
Expand Down Expand Up @@ -151,9 +152,11 @@ export class GameScene extends BaseScene {
this.state = state;

const isShopping = state === GameState.Shopping;

this.stations.forEach((s) => s.setClickable(isShopping));
this.employees.forEach((e) => e.setClickable(isShopping));
this.ui.setShoppingMode(isShopping);
if (isShopping) this.summaryOverlay.open();
}

// Start a new day
Expand Down Expand Up @@ -321,8 +324,7 @@ export class GameScene extends BaseScene {

// Open overlay if no more customers
if (this.customers.length === 0) {
this.summaryOverlay.setVisible(true);
this.state = GameState.Shopping;
this.setState(GameState.Shopping);
}
});

Expand Down

0 comments on commit 1528da6

Please sign in to comment.