export class GameOverContainer extends Phaser.GameObjects.Container {
    scene;
    gameOverText;
    restartText;
    constructor(scene) {
        super(scene, 0, 0);
        this.scene = scene;
        this.width = 200;
        this.height = 200;
        this.gameOverText = this.scene.add.image(0, 0, "game-over");
        this.restartText = this.scene.add.image(0, 80, "restart").setInteractive();
        this.setVisible(true);
        this.init();
        this.scene.add.existing(this);
    }
    init() {
        this.add([this.gameOverText, this.restartText])
            .setAlpha(0)
            .setDepth(3);
        // Handle resizing
        this.scene.scale.once('resize', this.scaleToFit, this);
        this.scene.scale.once('resize', this.positionOnMountain, this);
    }
    positionOnMountain() {
        this.setY(this.scene.scale.height / 2);
        this.setX(this.scene.scale.width / 2);
        this.setVisible(true);
    }
    scaleToFit() {
        // Use the scale factor from the Sky class to maintain consistency
        const height = this.height * (this.scene.mountain?.scaleFactors.height || 1);
        const width = this.width * (this.scene.mountain?.scaleFactors.width || 1);
        // Apply the scale factor to the player
        this.gameOverText.setDisplaySize(width * 4, height);
        this.restartText.setDisplaySize(width, height);
    }
}
