refactor(hero): 优化怪物生成位置计算并添加调试日志
- 使用 MonStart 配置计算怪物出生位置,替代硬编码的 MonSet - 添加 console.log 调试英雄和怪物的 siblingIndex - 根据 y 坐标动态判断线路,提高代码可读性和可维护性
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user