refactor(hero): 优化怪物生成位置计算并添加调试日志

- 使用 MonStart 配置计算怪物出生位置,替代硬编码的 MonSet
- 添加 console.log 调试英雄和怪物的 siblingIndex
- 根据 y 坐标动态判断线路,提高代码可读性和可维护性
This commit is contained in:
2025-11-04 11:12:43 +08:00
parent fc637529e2
commit 1e0537b63d
3 changed files with 12 additions and 6 deletions

View File

@@ -55,7 +55,8 @@ export class Hero extends ecs.Entity {
// 🔥 设置初始 SiblingIndex - 英雄基础层级 + 位置偏移
const initialSiblingIndex = IndexSet.HERO;
node.setSiblingIndex(initialSiblingIndex);
console.log("hero",node.getSiblingIndex());
// console.log("hero load",pos)
var hv = node.getComponent(HeroViewComp)!;
const model = this.get(HeroAttrsComp);

View File

@@ -55,7 +55,7 @@ export class Monster extends ecs.Entity {
const safeSpawnOrder = spawnOrder % 999; // 限制在999以内避免溢出到其他层级
const initialSiblingIndex = baseLane + safeSpawnOrder;
node.setSiblingIndex(initialSiblingIndex);
console.log("mon",node.getSiblingIndex());
var view = node.getComponent(HeroViewComp)!;
const model = this.get(HeroAttrsComp);
const skillsComp = this.get(HeroSkillsComp);