pinball/assets/_Game/Scripts/Gameplay/Outer.ts

18 lines
586 B
TypeScript
Raw Normal View History

2024-03-06 10:08:30 -08:00
import { _decorator, Collider2D, Component, Contact2DType, Node } from 'cc';
import { GameManager } from '../Manager/GameManager';
const { ccclass, property } = _decorator;
@ccclass('Outer')
export class Outer extends Component {
@property({ type: Collider2D, visible: true })
private _collider: Collider2D;
protected start(): void {
this._collider.on(Contact2DType.BEGIN_CONTACT, this.onBeginContact, this);
}
private onBeginContact(selfCollider: Collider2D, otherCollider: Collider2D) {
GameManager.instance.ballOut(otherCollider.node);
}
}