feat(boss): tint boss outline green in phase 2 and red in phase 3
Add FlashSprite.setPhaseOutline (P1 default / P2 green / P3 red) and drive it from BossPhaseSystem.onPhaseEnter; reset outline on pooled boss reuse so stale tint never leaks to the next owner. Red outline material asset must be created in editor (copy green, tint red) and bound to FlashSprite.outlineMatRed.
This commit is contained in:
@@ -19,6 +19,9 @@ export class FlashSprite extends Component {
|
||||
@property({ type: Material, tooltip: '黄色描边材质(5级)' })
|
||||
outlineMatYellow: Material | null = null;
|
||||
|
||||
@property({ type: Material, tooltip: '红色描边材质(Boss阶段3)' })
|
||||
outlineMatRed: Material | null = null;
|
||||
|
||||
orginalFlashMaterial: Material | null = null;
|
||||
defaultMaterial: Material | null = null; // 缓存最原始的无描边材质
|
||||
sprite: Sprite | null = null;
|
||||
@@ -64,6 +67,31 @@ export class FlashSprite extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置 Boss 阶段描边(与等级描边互斥,阶段优先)
|
||||
* @param phase 阶段索引 0=P1(无描边/恢复默认) 1=P2(绿) 2=P3(红)
|
||||
*/
|
||||
public setPhaseOutline(phase: number) {
|
||||
if (!this.sprite) {
|
||||
this.sprite = this.node.getComponent(Sprite);
|
||||
}
|
||||
|
||||
let targetMat: Material | null = null;
|
||||
if (phase === 1) {
|
||||
targetMat = this.outlineMatGreen;
|
||||
} else if (phase >= 2) {
|
||||
targetMat = this.outlineMatRed;
|
||||
} else {
|
||||
// P1 / 复位:恢复最原始的无描边材质
|
||||
targetMat = this.defaultMaterial;
|
||||
}
|
||||
|
||||
if (targetMat && this.sprite) {
|
||||
this.orginalFlashMaterial = targetMat;
|
||||
this.sprite.setSharedMaterial(targetMat, 0);
|
||||
}
|
||||
}
|
||||
|
||||
public clickFlash() {
|
||||
if (!this.sprite || !this.hitFlashMaterial) return;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user