fix(map,hero): 完善怪物入场排队逻辑
1. 给怪物刷出生成方法添加rank参数,用于计算出生位置 2. 新增怪物入场归位逻辑,替换原有的闲置状态处理 3. 更新注释描述,修正准备阶段怪物行为说明
This commit is contained in:
@@ -172,14 +172,15 @@ export class MissionMonCompComp extends CCComp {
|
||||
});
|
||||
|
||||
// 立即刷出 batch=0 的怪物(处理 delay 字段)
|
||||
for (const mon of immediate) {
|
||||
for (let i = 0; i < immediate.length; i++) {
|
||||
const mon = immediate[i];
|
||||
if (mon.delay && mon.delay > 0) {
|
||||
// Boss 延迟刷出
|
||||
this.scheduleOnce(() => {
|
||||
this.spawnMonster(mon);
|
||||
this.spawnMonster(mon, i);
|
||||
}, mon.delay);
|
||||
} else {
|
||||
this.spawnMonster(mon);
|
||||
this.spawnMonster(mon, i);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -202,14 +203,15 @@ export class MissionMonCompComp extends CCComp {
|
||||
/**
|
||||
* 刷出单个怪物(统一入口)
|
||||
* @param monData 怪物生成数据
|
||||
* @param rank 编队优先级排序后的名次(0=前排,1=中排,≥2=后排);缺省回退到 spawnIndex
|
||||
*/
|
||||
private spawnMonster(monData: GeneratedMonster) {
|
||||
private spawnMonster(monData: GeneratedMonster, rank?: number) {
|
||||
const posIndex = monData.spawnIndex;
|
||||
let mon = ecs.getEntity<Monster>(Monster);
|
||||
let scale = -1;
|
||||
|
||||
const basePos = MissionMonCompComp.MON_POSITIONS[posIndex % MissionMonCompComp.MON_POSITIONS.length];
|
||||
const landingX = this.resolveSpawnX(posIndex);
|
||||
const landingX = this.resolveSpawnX(rank ?? posIndex);
|
||||
const landingY = basePos.y;
|
||||
// 出生点位于目标排右侧屏幕外(dropToY=landingY 无下落),落地即 moving=true 从右跑入
|
||||
const spawnPos: Vec3 = v3(landingX + MissionMonCompComp.MON_SPAWN_OFFSET_X, landingY, 0);
|
||||
|
||||
Reference in New Issue
Block a user