diff --git a/assets/script/game/hero/MoveComp.ts b/assets/script/game/hero/MoveComp.ts index ad6dfaf2..69953770 100644 --- a/assets/script/game/hero/MoveComp.ts +++ b/assets/script/game/hero/MoveComp.ts @@ -47,7 +47,7 @@ export class MoveSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate private renderSortElapsed = 0; private heroMoveMatcher: ecs.IMatcher | null = null; private heroViewMatcher: ecs.IMatcher | null = null; - private readonly renderEntries: { node: Node; frontScore: number; spawnOrder: number; eid: number }[] = []; + private readonly renderEntries: { node: Node; bossPriority: number; frontScore: number; spawnOrder: number; eid: number }[] = []; private renderEntryCount = 0; private readonly facConfigs: Record = { @@ -431,10 +431,11 @@ export class MoveSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate const entryIndex = this.renderEntryCount; let entry = this.renderEntries[entryIndex]; if (!entry) { - entry = { node: actorView.node, frontScore: 0, spawnOrder: 0, eid: 0 }; + entry = { node: actorView.node, bossPriority: 0, frontScore: 0, spawnOrder: 0, eid: 0 }; this.renderEntries.push(entry); } entry.node = actorView.node; + entry.bossPriority = attrs.is_boss ? 1 : 0; entry.frontScore = frontScore; entry.spawnOrder = actorMove.spawnOrder; entry.eid = e.eid; @@ -443,6 +444,7 @@ export class MoveSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate this.renderEntries.length = this.renderEntryCount; this.renderEntries.sort((a, b) => { + if (a.bossPriority !== b.bossPriority) return a.bossPriority - b.bossPriority; if (a.frontScore !== b.frontScore) return a.frontScore - b.frontScore; if (a.spawnOrder !== b.spawnOrder) return a.spawnOrder - b.spawnOrder; return a.eid - b.eid; diff --git a/assets/script/game/map/MissionMonComp.ts b/assets/script/game/map/MissionMonComp.ts index 1996e180..14e3338d 100644 --- a/assets/script/game/map/MissionMonComp.ts +++ b/assets/script/game/map/MissionMonComp.ts @@ -9,12 +9,14 @@ import { GameEvent } from "../common/config/GameEvent"; import {BoxSet } from "../common/config/GameSet"; import { BossList, BossSpawnCd, MonList, MonType, SpawnBaseCd, SpawnMinCd, SpawnPowerBias, SpawnStageReduce, StageBossGrow, StageDuration, StageGrow, UpType } from "./RogueConfig"; import { HeroAttrsComp } from "../hero/HeroAttrsComp"; +import { MoveComp } from "../hero/MoveComp"; const { ccclass, property } = _decorator; /** 视图层对象 */ @ccclass('MissionMonCompComp') @ecs.register('MissionMonComp', false) export class MissionMonCompComp extends CCComp { + private static readonly BOSS_RENDER_PRIORITY = 1000000; @property({ tooltip: "是否启用调试日志" }) private debugMode: boolean = false; @@ -201,8 +203,13 @@ export class MissionMonCompComp extends CCComp { // 递增全局生成顺序,做溢出保护 this.globalSpawnOrder = (this.globalSpawnOrder + 1) % 999; - // 先用原始配置创建怪物,再覆盖成长后属性 mon.load(pos, scale, uuid, isBoss); + const move = mon.get(MoveComp); + if (move) { + move.spawnOrder = isBoss + ? MissionMonCompComp.BOSS_RENDER_PRIORITY + this.globalSpawnOrder + : this.globalSpawnOrder; + } const model = mon.get(HeroAttrsComp); const base = HeroInfo[uuid]; if (!model || !base) return;