|
@@ -198,20 +198,25 @@ export class TornadoComponent extends Component {
|
|
|
const targetTornado = otherCollider.node.parent.getComponent(TornadoComponent);
|
|
|
if (!targetTornado) return;
|
|
|
|
|
|
- const distance = Vec3.distance(event.selfCollider.node.worldPosition, otherCollider.node.worldPosition);
|
|
|
- if (distance < 1) {
|
|
|
- if (this.currentLv > targetTornado.currentLv) {
|
|
|
- // console.log(`玩家等级:${this.currentLv} 大于 targetTornado等级:${targetTornado.currentLv}`);
|
|
|
- StormSunderAudioMgr.playOneShot(StormSunderAudioMgr.getMusicIdName(5), 1.0);
|
|
|
- this.curHitObj = targetTornado.node;
|
|
|
- this.addExpByKill();
|
|
|
- this.killed(targetTornado.node);
|
|
|
-
|
|
|
- Effect2DUIMgr.inst.addPKInfo(this.nickName, targetTornado.nickName);
|
|
|
+ console.log(event.otherCollider.name);
|
|
|
+ if (event.selfCollider.node.name == 'RigibodyStorm') {
|
|
|
+ if (event.otherCollider.node.name == 'RigibodyStorm') {
|
|
|
+ const distance = Vec3.distance(event.selfCollider.node.worldPosition, otherCollider.node.worldPosition);
|
|
|
+ console.log(`龙卷风之间 distance:${distance}`);
|
|
|
+ if (distance <= 2) {
|
|
|
+ if (this.currentLv > targetTornado.currentLv) {
|
|
|
+ // console.log(`玩家等级:${this.currentLv} 大于 targetTornado等级:${targetTornado.currentLv}`);
|
|
|
+ StormSunderAudioMgr.playOneShot(StormSunderAudioMgr.getMusicIdName(5), 1.0);
|
|
|
+ this.curHitObj = targetTornado.node;
|
|
|
+ this.addExpByKill();
|
|
|
+ this.killed(targetTornado.node);
|
|
|
+
|
|
|
+ Effect2DUIMgr.inst.addPKInfo(this.nickName, targetTornado.nickName);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
//被击杀
|
|
@@ -343,6 +348,10 @@ export class TornadoComponent extends Component {
|
|
|
protected unregisterEvent() {
|
|
|
EventDispatcher.instance.off(GameEvent.EVENT_STORM_LEVEL_UP, this.stormLevelUp, this);
|
|
|
EventDispatcher.instance.off(GameEvent.EVENT_GAME_START_EFFECT, this.onGambitEffect, this);
|
|
|
+
|
|
|
+ this.tigger.off('onTriggerEnter', this.onTriggerEnter, this);
|
|
|
+ this.tigger.off('onTriggerStay', this.onTriggerStay, this);
|
|
|
+ this.tigger.off('onTriggerExit', this.onTriggerExit, this);
|
|
|
}
|
|
|
|
|
|
}
|