Sfoglia il codice sorgente

AI击杀问题 待修复

woso_javan 2 mesi fa
parent
commit
5869c762f2

+ 2 - 2
assets/module_storm_sunder/Prefabs/Storm.prefab

@@ -3288,14 +3288,14 @@
       "__id__": 244
     },
     "_material": null,
-    "_isTrigger": false,
+    "_isTrigger": true,
     "_center": {
       "__type__": "cc.Vec3",
       "x": 0,
       "y": 0,
       "z": 0
     },
-    "_radius": 1,
+    "_radius": 5,
     "_height": 2,
     "_direction": 1,
     "_id": ""

+ 16 - 14
assets/module_storm_sunder/Script/Component/TornadoAIComponent.ts

@@ -40,6 +40,7 @@ export class TornadoAIComponent extends TornadoComponent {
         this.onPlayerInfoHandler();
         this.decideAction(); // 进入行为循环
 
+        this.tigger.on('onTriggerEnter', this.onTriggerEnter, this);
         this.radiusTigger.on('onTriggerEnter', this.onRadiusTriggerEnter, this);
     }
 
@@ -60,7 +61,8 @@ export class TornadoAIComponent extends TornadoComponent {
         this.chasePlayerProbability = pursuit_2;
 
         //test 
-        this.chasePlayerProbability = 100;
+        // this.chaseAIProbability = 100;
+        // this.chasePlayerProbability = 100;
         this.moveProbability = move_judge;
 
         this.nextExp = this.attributeBonusMgr.getExpNeed(this.currentLv + 1);
@@ -117,6 +119,7 @@ export class TornadoAIComponent extends TornadoComponent {
     }
 
     protected onTriggerEnter(event: ITriggerEvent): void {
+        const otherCollider = event.otherCollider;
         if (event.otherCollider.getGroup() === 1 << 2) {
             this.unscheduleAllCallbacks();
             this.isChasing = false;
@@ -127,23 +130,22 @@ export class TornadoAIComponent extends TornadoComponent {
             this.setPositionByObstacle(event, () => {
                 this.decideAction();
             });
+        } else if (event.otherCollider.getGroup() === 1 << 3) {
+            if (otherCollider.getGroup() == 1 << 3) {
+                const targetTornado = otherCollider.node.parent.getComponent(TornadoComponent);
+                if (!targetTornado) return;
+
+                const isPlayer = targetTornado instanceof TornadoComponent;
+                if (this.currentLv > targetTornado.currentLv && isPlayer) {
+                    GameMgr.inst.isWin = false;
+                    GameMgr.inst.setGameStatus(GameStatus.Revive);
+                }
+            }
         }
     }
 
     protected onTriggerStay(event: ITriggerEvent): void {
         super.onTriggerStay(event);
-        const otherCollider = event.otherCollider;
-
-        if (otherCollider.getGroup() == 1 << 3) {
-            const targetTornado = otherCollider.node.parent.getComponent(TornadoComponent);
-            if (!targetTornado) return;
-
-            const isPlayer = targetTornado instanceof TornadoComponent;
-            if (this.currentLv > targetTornado.currentLv && isPlayer) {
-                GameMgr.inst.isWin = false;
-                GameMgr.inst.setGameStatus(GameStatus.Revive);
-            }
-        }
     }
 
     protected addExpByKill() {
@@ -171,7 +173,7 @@ export class TornadoAIComponent extends TornadoComponent {
                 if (Math.random() * 100 < this.chaseAIProbability) {
                     if (isTargetAI) {
                         // 目标是 AI,直接追击
-                        this.chaseTarget(targetTornado.node);
+                        // this.chaseTarget(targetTornado.node);
                     } else {
                         // 目标是玩家,进一步判断是否追击
                         if (Math.random() * 100 < this.chasePlayerProbability) {

+ 1 - 1
assets/module_storm_sunder/Script/Manager/TimerMgr.ts

@@ -19,7 +19,7 @@ export class TimerMgr {
         return this.Instance;
     }
 
-    public countDownTime: number = 10;
+    public countDownTime: number = 100;
     private timerId: number = 0;
     private propMgr: PropMgr;
 

+ 1 - 1
assets/module_storm_sunder/rooster_stormsunder.scene

@@ -777,7 +777,7 @@
     "propertyPath": [
       "_name"
     ],
-    "value": "Storm"
+    "value": "Player"
   },
   {
     "__type__": "cc.TargetInfo",