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:
@@ -7,15 +7,9 @@ export class FlashSprite extends Component {
|
||||
@property(Material)
|
||||
hitFlashMaterial: Material | null = null;
|
||||
|
||||
@property({ type: Material, tooltip: '绿色描边材质(2级)' })
|
||||
@property({ type: Material, tooltip: '绿色描边材质(2级 / Boss阶段2)' })
|
||||
outlineMatGreen: Material | null = null;
|
||||
|
||||
@property({ type: Material, tooltip: '淡绿描边材质(Boss阶段2)' })
|
||||
outlineMatGreenLight: Material | null = null;
|
||||
|
||||
@property({ type: Material, tooltip: '深绿描边材质(Boss阶段2备选)' })
|
||||
outlineMatGreenDark: Material | null = null;
|
||||
|
||||
@property({ type: Material, tooltip: '蓝色描边材质(3级)' })
|
||||
outlineMatBlue: Material | null = null;
|
||||
|
||||
@@ -25,8 +19,8 @@ export class FlashSprite extends Component {
|
||||
@property({ type: Material, tooltip: '黄色描边材质(5级)' })
|
||||
outlineMatYellow: Material | null = null;
|
||||
|
||||
@property({ type: Material, tooltip: '红色描边材质(Boss阶段3)' })
|
||||
outlineMatRed: Material | null = null;
|
||||
@property({ type: Material, tooltip: '红色描边材质(Boss阶段3,即 outline-glow)' })
|
||||
outlineMatGlow: Material | null = null;
|
||||
|
||||
orginalFlashMaterial: Material | null = null;
|
||||
defaultMaterial: Material | null = null; // 缓存最原始的无描边材质
|
||||
@@ -75,12 +69,11 @@ export class FlashSprite extends Component {
|
||||
|
||||
/**
|
||||
* 按 Boss 阶段设置描边材质(优先级高于等级描边)
|
||||
* Why: Boss 阶段是战斗强反馈(绿色警告 / 红色危险),与英雄等级成长是两套视觉语言,
|
||||
* 用独立通道避免污染 setOutlineByLevel 的等级语义
|
||||
* Why: Boss 阶段是战斗强反馈(P2 绿=警告 / P3 红=危险),与英雄等级成长是两套视觉语言,
|
||||
* 用独立通道避免污染 setOutlineByLevel 的等级语义;材质复用现有 outline-green / outline-glow
|
||||
* @param phase 阶段索引:1=P2 绿 / 2=P3 红 / 0=P1 恢复默认
|
||||
* @param greenShade P2 绿色色调:'light' 淡绿(默认)/ 'dark' 深绿
|
||||
*/
|
||||
public setOutlineByBossPhase(phase: number, greenShade: 'light' | 'dark' = 'light') {
|
||||
public setOutlineByBossPhase(phase: number) {
|
||||
if (!this.sprite) {
|
||||
this.sprite = this.node.getComponent(Sprite);
|
||||
}
|
||||
@@ -88,11 +81,9 @@ export class FlashSprite extends Component {
|
||||
|
||||
let targetMat: Material | null = null;
|
||||
if (phase === 1) {
|
||||
targetMat = greenShade === 'dark'
|
||||
? (this.outlineMatGreenDark ?? this.outlineMatGreenLight ?? this.outlineMatGreen)
|
||||
: (this.outlineMatGreenLight ?? this.outlineMatGreenDark ?? this.outlineMatGreen);
|
||||
targetMat = this.outlineMatGreen;
|
||||
} else if (phase >= 2) {
|
||||
targetMat = this.outlineMatRed ?? this.outlineMatYellow;
|
||||
targetMat = this.outlineMatGlow ?? this.outlineMatYellow;
|
||||
} else {
|
||||
targetMat = this.defaultMaterial;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user