woso_javan 2 ay önce
ebeveyn
işleme
9e88109038

+ 6 - 4
assets/module_storm_sunder/Script/Component/TornadoAIComponent.ts

@@ -44,9 +44,9 @@ export class TornadoAIComponent extends TornadoComponent {
 
     private initAIPlayer() {
         const aiConfig = PlayerMgr.inst.getRandomAIConfig();
-        console.log(aiConfig);
+        console.log(aiConfig.data);
         //text:名称 range:检测半径 move_juge:移动概率 move_time:移动时间 escape_time:逃跑时间 pursuit_1:追击玩家概率 pursuit_2:追击AI概率 pursuit_time:追击时间
-        const { text, range, move_juge, move_time, escape_time, pursuit_1, pursuit_2, pursuit_time } = aiConfig.data;
+        const { text, range, move_judge, move_time, escape_time, pursuit_1, pursuit_2, pursuit_time } = aiConfig.data;
         this.playerInfo.nickName = text;
         this.playerInfo.level = 2;
         this.currentLv = this.playerInfo.level;
@@ -56,7 +56,7 @@ export class TornadoAIComponent extends TornadoComponent {
         this.chaseDuration = Math.floor(pursuit_time[0] + Math.random() * (pursuit_time[1] - pursuit_time[0] + 1));
         this.chaseAIProbability = pursuit_1;
         this.chasePlayerProbability = pursuit_2;
-        this.moveProbability = move_juge;
+        this.moveProbability = move_judge;
 
         this.nextExp = this.attributeBonusMgr.getExpNeed(this.currentLv + 1);
         this.attack = this.attributeBonusMgr.getStormSunderAttack(this.currentLv, true);
@@ -70,6 +70,8 @@ export class TornadoAIComponent extends TornadoComponent {
         if (this.playerStatus == PlayerStatus.DIE) return; // AI 死亡时不执行行为
 
         const move = Math.random() * 100 < this.moveProbability;
+
+        // console.log(`AI 行为判断:移动概率:${this.moveProbability} 是否移动:${move}`);
         if (move) {
             this.randomMove();
         } else {
@@ -99,7 +101,7 @@ export class TornadoAIComponent extends TornadoComponent {
         const targetPosition = this.node.position.clone().add(randomDirection);
 
         PathfindingManager.getInstance().moveTo(this.node, targetPosition, this.moveDuration);
-        console.log(`AI 触发随机移动行为!`);
+        console.log(`AI 触发随机移动行为!`, targetPosition);
 
         this.scheduleOnce(() => {
             if (!this.isChasing && !this.isEscaping) { // 再次检查状态,避免重复调用

+ 2 - 2
assets/module_storm_sunder/Script/Manager/PlayerMgr.ts

@@ -26,7 +26,7 @@ export class PlayerMgr {
 
     public tornadoNode: Node = null;//玩家节点
     public aiPlayersConfig: Map<number, any> = new Map();//AI玩家配置
-    public createAIPlayerCount: number = 3;//创建AI玩家数量
+    public createAIPlayerCount: number = 1;//创建AI玩家数量
     public aiConfigCount: number = 3;//AI配置数量
 
     private aiIndex: number = 0;//AI索引
@@ -41,7 +41,7 @@ export class PlayerMgr {
                 let infoNode = instantiate(infoPrefab);
                 infoNode.parent = StormSunderGlobalInstance.instance.players;
 
-                const point = aiPoints.children[Math.floor(Math.random() * aiPoints.children.length)];
+                const point = aiPoints.children[i];
                 infoNode.setPosition(point.worldPosition.clone());
                 infoNode.addComponent(TornadoAIComponent);
                 resolve();

+ 3 - 1
assets/module_storm_sunder/Script/Manager/PropMgr.ts

@@ -99,7 +99,7 @@ export class PropMgr {
 
     /** 随机获取玩家附近的生成点 */
     getRandomSpawnPosition(): Vec3 {
-        if (!this.tornadoNode) return;
+        if (!this.tornadoNode || !this.tornadoNode.worldPosition) return;
 
         let playerPos = this.tornadoNode.worldPosition;
 
@@ -113,6 +113,8 @@ export class PropMgr {
 
     /** 检测当前位置是否有障碍物 */
     isPositionBlocked(position: Vec3): boolean {
+        if (!position.x || !position.y || !position.z) return false;
+
         let ray = new geometry.Ray(position.x, position.y, position.z, 0, 0, 0);
 
         if (PhysicsSystem.instance.raycastClosest(ray, this.raycastDistance)) {

Dosya farkı çok büyük olduğundan ihmal edildi
+ 557 - 80
assets/module_storm_sunder/rooster_stormsunder.scene


Bu fark içinde çok fazla dosya değişikliği olduğu için bazı dosyalar gösterilmiyor