Browse Source

待处理击杀

woso_javan 2 months ago
parent
commit
838204e4ec

+ 2 - 1
assets/module_storm_sunder/Script/Component/TornadoAIComponent.ts

@@ -177,7 +177,7 @@ export class TornadoAIComponent extends TornadoComponent {
 
             if (targetLv > this.currentLv) {
                 // 目标等级比自己高 → 逃跑
-                this.escapeFrom(targetTornado.node);
+                // this.escapeFrom(targetTornado.node);
             } else if (targetLv < this.currentLv) {
                 // 目标等级比自己低 → 先判断是否追击
                 if (Math.random() * 100 < this.chaseAIProbability) {
@@ -260,6 +260,7 @@ export class TornadoAIComponent extends TornadoComponent {
     }
 
     protected onDestroy(): void {
+        super.onDestroy();
         this.cancelAction();
         EventDispatcher.instance.off(GameEvent.EVENT_GAME_START, this.decideAction, this);
         EventDispatcher.instance.off(GameEvent.EVENT_GAME_START_EFFECT, this.decideAction, this);

+ 20 - 11
assets/module_storm_sunder/Script/Component/TornadoComponent.ts

@@ -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);
     }
 
 }

+ 1 - 0
assets/module_storm_sunder/Script/Manager/PlayerMgr.ts

@@ -38,6 +38,7 @@ export class PlayerMgr {
         return new Promise(async (resolve, reject) => {
             const mapConfig = MapMgr.Instance.getMapConfig(1);
             this.createAIPlayerCount = mapConfig.count;
+            this.createAIPlayerCount = 3;//测试
             const aiPoints = StormSunderGlobalInstance.instance.aiPoints;
             for (let i = 0; i < this.createAIPlayerCount; i++) {
                 const infoPrefab = await resLoader.loadAsync(resLoader.gameBundleName, res[0], Prefab);