18 lines
586 B
TypeScript
18 lines
586 B
TypeScript
|
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);
|
||
|
}
|
||
|
}
|