48 lines
1.2 KiB
JavaScript
48 lines
1.2 KiB
JavaScript
import { InterfaceManager } from '../support/interfaceManager.js';
|
|
|
|
export class UIScene extends Phaser.Scene {
|
|
|
|
constructor() {
|
|
super({ key: 'UIScene' });
|
|
}
|
|
|
|
init(data) {
|
|
|
|
}
|
|
|
|
preload() {
|
|
this.load.image('intMain', 'assets/intMain.png');
|
|
this.load.image('redArrow', 'assets/redArrow.png');
|
|
this.load.image('intTop', 'assets/intTop.png');
|
|
this.load.image('gold', 'assets/gold.png');
|
|
this.load.image('intUpgrade', 'assets/intUpgrade.png');
|
|
this.load.spritesheet('nextWave', 'assets/nextWave.png', {
|
|
frameHeight: 150,
|
|
frameWidth: 150
|
|
});
|
|
}
|
|
|
|
create() {
|
|
this.levelScene = this.scene.get('Level');
|
|
this.interfaceManager = new InterfaceManager(this);
|
|
this.cameras.main.setBounds(0, 0, 1600, 900);
|
|
}
|
|
|
|
update(time, delta) {
|
|
this.interfaceManager.update(time, delta);
|
|
}
|
|
|
|
addGold(amount) {
|
|
this.interfaceManager.gold += amount;
|
|
this.updateGold();
|
|
}
|
|
|
|
removeGold(amount) {
|
|
this.interfaceManager.gold -= amount;
|
|
this.updateGold();
|
|
}
|
|
|
|
updateGold() {
|
|
this.interfaceManager.goldText.setText(`${this.interfaceManager.gold}`);
|
|
}
|
|
} |