Browse Source

远程·距离

181404010226 1 month ago
parent
commit
dea154e131

BIN
assets/Animation/EnemyAni/003/ball.png


+ 20 - 20
assets/Animation/EnemyAni/003/ball.png.meta

@@ -45,10 +45,10 @@
         "offsetY": 0,
         "trimX": 0,
         "trimY": 0,
-        "width": 65,
-        "height": 65,
-        "rawWidth": 65,
-        "rawHeight": 65,
+        "width": 33,
+        "height": 33,
+        "rawWidth": 33,
+        "rawHeight": 33,
         "borderTop": 0,
         "borderBottom": 0,
         "borderLeft": 0,
@@ -60,17 +60,17 @@
         "meshType": 0,
         "vertices": {
           "rawPosition": [
-            -32.5,
-            -32.5,
+            -16.5,
+            -16.5,
             0,
-            32.5,
-            -32.5,
+            16.5,
+            -16.5,
             0,
-            -32.5,
-            32.5,
+            -16.5,
+            16.5,
             0,
-            32.5,
-            32.5,
+            16.5,
+            16.5,
             0
           ],
           "indexes": [
@@ -83,12 +83,12 @@
           ],
           "uv": [
             0,
-            65,
-            65,
-            65,
+            33,
+            33,
+            33,
             0,
             0,
-            65,
+            33,
             0
           ],
           "nuv": [
@@ -102,13 +102,13 @@
             1
           ],
           "minPos": [
-            -32.5,
-            -32.5,
+            -16.5,
+            -16.5,
             0
           ],
           "maxPos": [
-            32.5,
-            32.5,
+            16.5,
+            16.5,
             0
           ]
         },

+ 4 - 7
assets/assets/Prefabs/Enemy.prefab

@@ -93,7 +93,7 @@
     "_lpos": {
       "__type__": "cc.Vec3",
       "x": 0,
-      "y": 38.84161490683229,
+      "y": 80.842,
       "z": 0
     },
     "_lrot": {
@@ -861,7 +861,7 @@
     "_lpos": {
       "__type__": "cc.Vec3",
       "x": 0,
-      "y": -74.65838509316771,
+      "y": -32.658,
       "z": 0
     },
     "_lrot": {
@@ -942,7 +942,7 @@
       "__expectedType__": "sp.SkeletonData"
     },
     "defaultSkin": "default",
-    "defaultAnimation": "",
+    "defaultAnimation": "<None>",
     "_premultipliedAlpha": true,
     "_timeScale": 1,
     "_preCacheMode": 0,
@@ -1037,8 +1037,6 @@
       "__id__": 0
     },
     "fileId": "a25hnm9KdA1Zduj43oPQky",
-    "instance": null,
-    "targetOverrides": null,
     "nestedPrefabInstanceRoots": null
   },
   {
@@ -1050,7 +1048,6 @@
       "__id__": 0
     },
     "fileId": "38hOg6AAZGVojOqsmsY5rA",
-    "instance": null,
-    "targetOverrides": null
+    "instance": null
   }
 ]

BIN
assets/data/excel/关卡配置/~$关卡配置表.xlsx


+ 12 - 0
assets/data/excel/方块武器配置/~$方块武器配置表.xlsx.meta

@@ -0,0 +1,12 @@
+{
+  "ver": "1.0.0",
+  "importer": "*",
+  "imported": true,
+  "uuid": "6edc7488-60aa-42c5-b8a3-fd9e94f3569e",
+  "files": [
+    ".json",
+    ".xlsx"
+  ],
+  "subMetas": {},
+  "userData": {}
+}

BIN
assets/data/excel/方块武器配置/方块武器配置表.xlsx


+ 1 - 1
assets/data/weapons.json

@@ -841,7 +841,7 @@
     {
       "id": "okra_missile",
       "name": "秋葵导弹",
-      "type": "homing_missile",
+      "type": "explosive",
       "weight": 8,
       "unlockLevel": 13,
       "rarityDamageMultipliers": [

+ 12 - 13
assets/scripts/CombatSystem/BulletEffects/BulletCount.ts

@@ -233,15 +233,18 @@ export class BulletCount extends Component {
                     direction = nearestEnemy.worldPosition.clone().subtract(initData.firePosition).normalize();
                 }
             }
-            // 如果没有敌人或计算失败,则回退为随机方向
+            // 如果没有敌人或计算失败,则不创建子弹
             if (!direction) {
-                const angleRand = Math.random() * Math.PI * 2;
-                direction = new Vec3(Math.cos(angleRand), Math.sin(angleRand), 0);
+                console.log('【BulletCount】自动瞄准未找到有效目标,取消创建子弹');
+                return [];
             }
         } else {
-            direction = new Vec3(1, 0, 0);
+            // 非自动瞄准时使用默认方向
+            const angleRand = Math.random() * Math.PI * 2;
+            direction = new Vec3(Math.cos(angleRand), Math.sin(angleRand), 0);
         }
         
+        // 计算批量生成信息(保持原逻辑)
         const spawnInfos = BulletCount.calculateBulletSpawns(
             modifiedConfig.bulletConfig.count,
             initData.firePosition,
@@ -250,12 +253,11 @@ export class BulletCount extends Component {
         
         const bullets: Node[] = [];
         
-        // 为每个子弹创建实例
+        // 为每个生成信息创建子弹实例
         for (const spawnInfo of spawnInfos) {
-            const createBullet = () => {
+            try {
                 const bullet = instantiate(bulletPrefab);
                 const weaponBullet = bullet.getComponent(WeaponBullet) || bullet.addComponent(WeaponBullet);
-                // 初始化子弹
                 weaponBullet.init({
                     ...initData,
                     firePosition: spawnInfo.position,
@@ -263,14 +265,11 @@ export class BulletCount extends Component {
                     weaponConfig: modifiedConfig
                 });
                 bullets.push(bullet);
-            };
-            // 处理延迟发射
-            if (spawnInfo.delay > 0) {
-                setTimeout(createBullet, spawnInfo.delay * 1000);
-            } else {
-                createBullet();
+            } catch (error) {
+                console.error(`[BulletCount] 子弹创建失败:`, error);
             }
         }
+        
         return bullets;
     }
 

+ 2 - 2
assets/scripts/CombatSystem/EnemyInstance.ts

@@ -819,7 +819,7 @@ export class EnemyInstance extends Component {
         // 根据巡逻范围决定方向变化
         const enemySprite = this.node.getChildByName('EnemySprite');
         if (enemySprite && this.controller) {
-            const currentPos = enemySprite.worldPosition;
+            const currentPos = this.node.worldPosition.clone();
             const bounds = this.controller.gameBounds;
             
             // 检查是否到达巡逻边界
@@ -1442,7 +1442,7 @@ export class EnemyInstance extends Component {
         const enemySprite = this.node.getChildByName('EnemySprite');
         if (!enemySprite) return;
 
-        const currentPos = enemySprite.worldPosition;
+        const currentPos = this.node.worldPosition;
         
         // 获取敌人的攻击范围配置
         const enemyComponent = this.getComponent(EnemyComponent);

+ 15 - 11
assets/scripts/CombatSystem/WeaponBullet.ts

@@ -187,10 +187,10 @@ export class WeaponBullet extends Component {
                 direction = nearestEnemy.worldPosition.clone().subtract(initData.firePosition).normalize();
             }
 
-            // 如果没有敌人或计算失败,则回退为随机方向
+            // 自动瞄准未找到有效目标时,不发射子弹
             if (!direction) {
-                const angleRand = Math.random() * Math.PI * 2;
-                direction = new Vec3(Math.cos(angleRand), Math.sin(angleRand), 0);
+                console.log('[WeaponBullet] 自动瞄准未找到有效目标,取消发射子弹');
+                return [];
             }
         } else {
             direction = new Vec3(1, 0, 0);
@@ -226,7 +226,7 @@ export class WeaponBullet extends Component {
                     return null;
                 }
             };
-            
+
             // 处理延迟发射 - 对于burst模式,所有子弹都应该被创建并返回
             if (spawnInfo.delay > 0) {
                 // 延迟发射:先创建子弹,然后延迟激活
@@ -341,6 +341,13 @@ export class WeaponBullet extends Component {
         // 计算方向
         const direction = initData.direction || this.calculateDirection(initData.autoTarget);
         
+        // 自动瞄准且未找到目标时,取消初始化子弹
+        if (!direction && initData.autoTarget) {
+            console.log('[WeaponBullet] 自动瞄准未找到目标,取消初始化子弹');
+            this.node.destroy();
+            return;
+        }
+        
         // === 根据发射方向调整朝向 ===
         // 说明:
         // - 当 shouldRotate !== false 时,保持父节点按发射方向旋转,并启用持续自旋转(原逻辑)。
@@ -375,10 +382,8 @@ export class WeaponBullet extends Component {
         );
         
         // --- 额外偏移 ---
-        // 若子弹在生成时与发射方块碰撞(位置重叠), 会立刻触发碰撞事件导致被销毁。
-        // 因此在初始化完弹道后, 将子弹沿发射方向平移一小段距离(默认 30 像素左右)。
         const dir = direction.clone().normalize();
-        const spawnOffset = 30; // 可根据子弹半径或方块大小调整
+        const spawnOffset = 30;
         if (!Number.isNaN(dir.x) && !Number.isNaN(dir.y)) {
             const newLocalPos = this.node.position.clone().add(new Vec3(dir.x * spawnOffset, dir.y * spawnOffset, 0));
             this.node.setPosition(newLocalPos);
@@ -438,7 +443,7 @@ export class WeaponBullet extends Component {
     /**
      * 计算子弹方向
      */
-    private calculateDirection(autoTarget: boolean = false): Vec3 {
+    private calculateDirection(autoTarget: boolean = false): Vec3 | null {
         if (!autoTarget) {
             // 随机方向
             const angle = Math.random() * Math.PI * 2;
@@ -454,9 +459,8 @@ export class WeaponBullet extends Component {
             return direction;
         }
         
-        // 若没有敌人则随机方向发射
-        const angle = Math.random() * Math.PI * 2;
-        return new Vec3(Math.cos(angle), Math.sin(angle), 0);
+        // 自动瞄准模式下,无目标则返回 null,不再随机发射
+        return null;
     }
     
     /**

+ 11 - 6
assets/scripts/FourUI/SkillSystem/PersistentSkillManager.ts

@@ -105,19 +105,25 @@ export class PersistentSkillManager extends Component {
     }
 
     /**
-     * 计算指定技能类型的总效果
+     * 计算指定技能类型的总效果(按最新点亮的节点值,不再对历史节点累加)
      * @param skillType 技能类型
      * @returns 总效果百分比
      */
     private calculateTotalEffect(skillType: string): number {
         const skillArray = this._unlockedSkills.get(skillType);
-        if (!skillArray) {
+        if (!skillArray || skillArray.length === 0) {
             return 0;
         }
 
-        return skillArray.reduce((total, skill) => {
-            return total + (skill.unlocked ? skill.effectPercent : 0);
-        }, 0);
+        // 返回已点亮节点中最大的效果值(因顺序解锁,最大即最新)
+        let latestEffect = 0;
+        for (let i = 0; i < skillArray.length; i++) {
+            const skill = skillArray[i];
+            if (skill.unlocked) {
+                latestEffect = Math.max(latestEffect, skill.effectPercent);
+            }
+        }
+        return latestEffect;
     }
 
     /**
@@ -248,7 +254,6 @@ export class PersistentSkillManager extends Component {
 
     /**
      * 获取技能统计信息
-     * @returns 技能统计信息
      */
     public getSkillStats() {
         const stats = {