2024-03-06 10:08:30 -08:00
|
|
|
import { _decorator, Collider2D, Component, Contact2DType, Node } from 'cc';
|
|
|
|
import { GameManager } from '../Manager/GameManager';
|
2024-03-07 09:45:13 -08:00
|
|
|
import ObjectPool from '../Pool/ObjectPool';
|
2024-03-06 10:08:30 -08:00
|
|
|
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) {
|
2024-03-07 09:45:13 -08:00
|
|
|
ObjectPool.release(otherCollider.node);
|
|
|
|
GameManager.instance.ballOut();
|
2024-03-06 10:08:30 -08:00
|
|
|
}
|
|
|
|
}
|