|
@@ -62,8 +62,6 @@ export default class JG0111 extends BaseEvent {
|
|
*/
|
|
*/
|
|
public isOver = false;
|
|
public isOver = false;
|
|
|
|
|
|
- private count = 0;
|
|
|
|
-
|
|
|
|
onLoad(){
|
|
onLoad(){
|
|
super.onLoad();
|
|
super.onLoad();
|
|
this.node.zIndex = -9999;
|
|
this.node.zIndex = -9999;
|
|
@@ -71,37 +69,36 @@ export default class JG0111 extends BaseEvent {
|
|
|
|
|
|
onBeginContact(contact: cc.PhysicsContact, self: cc.PhysicsCollider, other: cc.PhysicsCollider) {
|
|
onBeginContact(contact: cc.PhysicsContact, self: cc.PhysicsCollider, other: cc.PhysicsCollider) {
|
|
if (other.node.group != 'bullet') {
|
|
if (other.node.group != 'bullet') {
|
|
- this.count++
|
|
|
|
- this.onBegin(self.tag)
|
|
|
|
|
|
+ this.onBegin(other.tag)
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
onEndContact(contact: cc.PhysicsContact, self: cc.PhysicsCollider, other: cc.PhysicsCollider) {
|
|
onEndContact(contact: cc.PhysicsContact, self: cc.PhysicsCollider, other: cc.PhysicsCollider) {
|
|
if (other.node.group != 'bullet') {
|
|
if (other.node.group != 'bullet') {
|
|
- this.count--
|
|
|
|
- if (this.count <= 0) {
|
|
|
|
- this.count = 0;
|
|
|
|
- this.onEnd(self.tag)
|
|
|
|
- }
|
|
|
|
|
|
+ this.onEnd(other.tag)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
onBegin(tag: number) {
|
|
onBegin(tag: number) {
|
|
- this.isHang = true;
|
|
|
|
- this.mIcon.spriteFrame = this.mIcon1;
|
|
|
|
- this.checkOpen();
|
|
|
|
|
|
+ if(tag == 1){
|
|
|
|
+ this.isHang = true;
|
|
|
|
+ this.mIcon.spriteFrame = this.mIcon1;
|
|
|
|
+ this.checkOpen();
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
onEnd(tag: number) {
|
|
onEnd(tag: number) {
|
|
- this.isHang = false
|
|
|
|
- this.mIcon.spriteFrame = this.mIcon0
|
|
|
|
- this.isOver = false;
|
|
|
|
- for (let i = 0; i < this.mFenceTrigger.length; i++) {
|
|
|
|
- const element = this.mFenceTrigger[i];
|
|
|
|
- // element.active = true;
|
|
|
|
- this.showFence(element, SpineName.CLOSE);
|
|
|
|
- element.getComponent(cc.PhysicsBoxCollider).enabled = true;
|
|
|
|
|
|
+ if(tag == 1){
|
|
|
|
+ this.isHang = false
|
|
|
|
+ this.mIcon.spriteFrame = this.mIcon0
|
|
|
|
+ this.isOver = false;
|
|
|
|
+ for (let i = 0; i < this.mFenceTrigger.length; i++) {
|
|
|
|
+ const element = this.mFenceTrigger[i];
|
|
|
|
+ // element.active = true;
|
|
|
|
+ this.showFence(element, SpineName.CLOSE);
|
|
|
|
+ element.getComponent(cc.PhysicsBoxCollider).enabled = true;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|