feat(渲染): 重构渲染层级管理并添加BOSS层级

移除动态渲染层级更新逻辑,改为在实体加载时设置固定层级
- 在Hero和Monster的load方法中设置初始siblingIndex
- 添加BOSS枚举值到IndexSet
- 为Monster添加溢出保护,防止层级索引过大
- 删除墓地位置判断等不再需要的逻辑
This commit is contained in:
2025-11-03 13:36:33 +08:00
parent 96952ef493
commit 9fcb6d3121
6 changed files with 20 additions and 71 deletions

View File

@@ -4,7 +4,7 @@ import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ec
import { smc } from "../common/SingletonModuleComp";
import { HeroAttrsComp } from "./HeroAttrsComp";
import { HeroViewComp } from "./HeroViewComp";
import { BoxSet, FacSet } from "../common/config/GameSet";
import { BoxSet, FacSet, IndexSet } from "../common/config/GameSet";
import { HeroInfo, HeroPos, HType } from "../common/config/heroSet";
import { GameEvent } from "../common/config/GameEvent";
import { SkillSet } from "../common/config/SkillSet";
@@ -50,6 +50,11 @@ export class Hero extends ecs.Entity {
const collider = node.getComponent(BoxCollider2D);
if (collider) collider.enabled = false; // 先禁用
node.setPosition(pos)
// 🔥 设置初始 SiblingIndex - 英雄基础层级 + 位置偏移
const initialSiblingIndex = IndexSet.HERO;
node.setSiblingIndex(initialSiblingIndex);
// console.log("hero load",pos)
var hv = node.getComponent(HeroViewComp)!;
const model = this.get(HeroAttrsComp);