From 011e7b3dde4e0279a750fb150ce5da4ac1e70553 Mon Sep 17 00:00:00 2001 From: pan Date: Thu, 13 Aug 2026 09:31:40 +0800 Subject: [PATCH] =?UTF-8?q?refactor(MissionHeroComp):=20=E9=87=8D=E6=9E=84?= =?UTF-8?q?=E8=8B=B1=E9=9B=84=E7=99=BB=E5=9C=BA=E7=82=B9=E4=BD=8D=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. 将动态生成的英雄站位改为硬编码固定3列位置 2. 更新站位分配优先级适配新的点位数组 3. 优化注释说明,明确点位规则和分配逻辑 --- assets/script/game/map/MissionHeroComp.ts | 25 ++++++++++------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/assets/script/game/map/MissionHeroComp.ts b/assets/script/game/map/MissionHeroComp.ts index 21bc92a3..46d160b8 100644 --- a/assets/script/game/map/MissionHeroComp.ts +++ b/assets/script/game/map/MissionHeroComp.ts @@ -54,19 +54,16 @@ export class MissionHeroComp extends CCComp { // ======================== 常量 ======================== /** - * 英雄登场占位点: - * - 从 x=-300 开始,每个点位间隔 60(x 向右递增表示更靠前)。 - * - 分配规则:近战优先靠前(靠近 0 的高索引),远程/中程优先靠后(低索引)。 + * 英雄登场占位点(固定 3 列): + * - index 0/1/2 分别对应 x=-320/-260/-200。 + * - 分配规则:近战优先靠前(x 更大),远程/中程优先靠后(x 更小); + * 同类型按召唤先后从该类型的一侧开始依次填充。 */ - public static readonly HERO_POSITIONS: Vec3[] = (() => { - const startX = -300; - const step = 60; - const positions: Vec3[] = []; - for (let i = 0; i < FightSet.HERO_MAX_NUM; i++) { - positions.push(v3(startX + i * step, BoxSet.GAME_LINE, 0)); - } - return positions; - })(); + public static readonly HERO_POSITIONS: Vec3[] = [ + v3(-320, BoxSet.GAME_LINE, 0), + v3(-260, BoxSet.GAME_LINE, 0), + v3(-200, BoxSet.GAME_LINE, 0), + ]; /** 英雄出生时的掉落高度(从空中落到地面的像素差) */ private static readonly HERO_DROP_HEIGHT = 260 @@ -218,8 +215,8 @@ export class MissionHeroComp extends CCComp { // 近战优先靠前(x 更大,索引更大);远程/中程优先靠后(x 更小,索引更小) const slotPriority = heroType === HType.Melee - ? [9, 8, 7, 6, 5, 4, 3, 2, 1, 0] - : [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; + ? [2, 1, 0] + : [0, 1, 2]; for (const idx of slotPriority) { if (!occupied.has(idx) && MissionHeroComp.HERO_POSITIONS[idx]) { return idx;