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:
panFD
2026-10-10 00:25:23 +08:00
parent 11ba692f18
commit b31d870d90
4 changed files with 59 additions and 2 deletions

View File

@@ -18,7 +18,9 @@ import { BossPhaseSet, PhaseSwitchDef } from "../common/config/BossPhaseSet";
import { SkillSet } from "../common/config/SkillSet";
import { mLogger } from "../common/Logger";
import { HeroAttrsComp } from "./HeroAttrsComp";
import { HeroViewComp } from "./HeroViewComp";
import { BossPhaseComp } from "./BossPhaseComp";
import { FlashSprite } from "./hit-flash-white/scripts/FlashSprite";
/** 阶段模块调试日志开关 */
const DEBUG = true;
@@ -124,6 +126,18 @@ export class BossPhaseSystem extends ecs.ComblockSystem implements ecs.ISystemUp
/** TODO: 阶段退场表现(震屏/变暗等),后续迭代实现 */
private onPhaseExit(e: ecs.Entity): void { }
/** TODO: 阶段入场表现(怒吼/无敌帧/技能横幅等),后续迭代实现 */
private onPhaseEnter(e: ecs.Entity): void { }
/** 阶段入场表现:切换阶段描边(P2 绿 / P3 红);怒吼/无敌帧/横幅等后续迭代 */
private onPhaseEnter(e: ecs.Entity): void {
const view = e.get(HeroViewComp);
if (!view || !view.node || !view.node.isValid) return;
const phase = e.get(BossPhaseComp)!;
// FlashSprite 可能在根节点或子节点(anm)上,逐级查找
let flash = view.node.getComponent(FlashSprite);
if (!flash) {
flash = view.node.getComponentInChildren(FlashSprite);
}
if (flash) {
flash.setPhaseOutline(phase.index);
}
}
}