2024-03-08 03:07:41 -08:00
|
|
|
import { _decorator, Component, Node } from 'cc';
|
|
|
|
import { EventManger } from '../Manager/EventManger';
|
|
|
|
import GameEvent from '../Events/GameEvent';
|
|
|
|
const { ccclass, property } = _decorator;
|
|
|
|
|
|
|
|
@ccclass('Gate')
|
|
|
|
export class Gate extends Component {
|
|
|
|
@property({ type: Node, visible: true })
|
|
|
|
private _gate: Node;
|
|
|
|
|
|
|
|
protected onLoad(): void {
|
|
|
|
EventManger.instance.on(GameEvent.BallOut, this.reset, this);
|
|
|
|
}
|
|
|
|
|
|
|
|
private reset() {
|
2024-03-21 01:59:08 -07:00
|
|
|
this.close();
|
2024-03-08 03:07:41 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
public close() {
|
|
|
|
this._gate.active = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
public open() {
|
|
|
|
this._gate.active = false;
|
|
|
|
}
|
|
|
|
}
|