import Global from "./Global";
|
|
const { ccclass, property } = cc._decorator;
|
|
@ccclass
|
export default class Prop extends cc.Component {
|
|
@property
|
propType: number = 0;
|
|
private manager = null;
|
reuse(manager) {
|
this.manager = manager;
|
}
|
|
// 只在两个碰撞体开始接触时被调用一次
|
onBeginContact(contact: cc.PhysicsContact, selfCollider: cc.Collider, otherCollider: cc.Collider) {
|
if (otherCollider.tag == Global.TAG_WALL_BOTTOM) {//球到底了
|
this.node.runAction(cc.callFunc(this.recycle, this));
|
}else{
|
this.manager.pickupProp(this.propType);
|
this.node.runAction(cc.callFunc(this.recycle, this));
|
}
|
}
|
|
recycle() {
|
this.manager.recycleProp(this);
|
}
|
}
|