import { eventTarget, RESET_BOTTLE, SHOW_ACTION_SCREEN, SHOW_START_SCREEN } from "../Events";

const { ccclass, property } = cc._decorator;

@ccclass
export default class BreakingBottleScreen extends cc.Component {

    onLoad() {
        eventTarget.on(SHOW_ACTION_SCREEN, this.showScreen, this);
        eventTarget.on(SHOW_START_SCREEN, this.hideScreen, this);
        this.node.position = cc.v3(0, 0, 0);
        this.node.opacity = 0;
    }

    private showScreen() {
        this.node.opacity = 255;
        this.node.position = cc.v3();
        eventTarget.emit(RESET_BOTTLE);
    }

    private hideScreen() {
        this.node.opacity = 0;
    }

}
