fix(boss): keep phase outline authoritative over level tint and pool reuse

Reuse existing outline-green/outline-glow materials (P2 green / P3 red); phase outline now takes priority over level tint during boss lifetime (init/lv_up both route through BossPhaseComp), and HeroViewComp.reset clears the material back to default so pooled monster nodes never inherit a boss's red/green edge.
This commit is contained in:
panFD
2026-10-10 00:40:47 +08:00
parent a122d0904c
commit 74d03facd9
2 changed files with 30 additions and 22 deletions

View File

@@ -16,6 +16,7 @@ import { Tooltip } from "../skill/Tooltip";
import { timedCom } from "../skill/timedCom";
import { oneCom } from "../skill/oncend";
import { FlashSprite } from "./hit-flash-white/scripts/FlashSprite";
import { BossPhaseComp } from "./BossPhaseComp";
const { ccclass, property } = _decorator;
@@ -89,7 +90,6 @@ export class HeroViewComp extends CCComp {
this.deadCD = 0;
this.lastBarUpdateTime = 0;
this.status_change("idle");
// 初始化头顶状态栏
const topNode = this.node.getChildByName("top");
this.topBar = topNode.getComponent(HeroTopBarComp) || topNode.addComponent(HeroTopBarComp);
@@ -98,8 +98,13 @@ export class HeroViewComp extends CCComp {
/** 方向 */
this.node.setScale(this.scale * Math.abs(this.node.scale.x), 1 * this.node.scale.y); // 确保 scale.x 为正后再乘方向
// 🔥 重置描边
this.applyOutlineByLevel();
// 🔥 重置描边:Boss 阶段描边优先(Boss 存活期不被等级描边覆盖),其余按等级
const phaseComp = this.ent ? this.ent.get(BossPhaseComp) : null;
if (phaseComp && phaseComp.index > 0) {
this.applyBossPhaseOutline(phaseComp.index);
} else {
this.applyOutlineByLevel();
}
}
/**
@@ -162,8 +167,13 @@ export class HeroViewComp extends CCComp {
public lv_up() {
this.spawnTimedFx("game/skill/buff/buff_lvup", this.node, 1.0);
// 升级时同步更新描边
this.applyOutlineByLevel();
// 升级时同步更新描边:Boss 阶段描边优先(与 init 口径一致)
const phaseComp = this.ent ? this.ent.get(BossPhaseComp) : null;
if (phaseComp && phaseComp.index > 0) {
this.applyBossPhaseOutline(phaseComp.index);
} else {
this.applyOutlineByLevel();
}
}
/** 按英雄等级应用描边(升级/初始化共用入口) */
@@ -577,6 +587,13 @@ export class HeroViewComp extends CCComp {
this.deadCD = 0
this.lastBarUpdateTime = 0
// 清掉描边材质:防 Boss 阶段描边(绿/红)随对象池节点复用串到小怪/英雄身上
const flashSprite = this.getFlashSprite();
if (flashSprite && flashSprite.defaultMaterial) {
flashSprite.orginalFlashMaterial = flashSprite.defaultMaterial;
flashSprite.sprite?.setSharedMaterial(flashSprite.defaultMaterial, 0);
}
// 清理伤害队列
this.damageQueue.length = 0;
this.isProcessingDamage = false;