feat(boss): tint boss sprite outline by phase (P2 green, P3 red)
Add FlashSprite.setOutlineByBossPhase with light/dark green shade option and red fallback; BossPhaseSystem drives HeroViewComp.applyBossPhaseOutline directly after phase switch (MON faction, no hero-level event semantics, pool-node safe); extract getFlashSprite/applyOutlineByLevel to dedupe the three outline call sites.
This commit is contained in:
@@ -99,15 +99,7 @@ export class HeroViewComp extends CCComp {
|
||||
this.node.setScale(this.scale * Math.abs(this.node.scale.x), 1 * this.node.scale.y); // 确保 scale.x 为正后再乘方向
|
||||
|
||||
// 🔥 重置描边
|
||||
if (this.model) {
|
||||
let flashSprite = this.node.getComponent(FlashSprite);
|
||||
if (!flashSprite) {
|
||||
flashSprite = this.node.getComponentInChildren(FlashSprite);
|
||||
}
|
||||
if (flashSprite) {
|
||||
flashSprite.setOutlineByLevel(this.model.lv);
|
||||
}
|
||||
}
|
||||
this.applyOutlineByLevel();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -171,17 +163,36 @@ export class HeroViewComp extends CCComp {
|
||||
this.spawnTimedFx("game/skill/buff/buff_lvup", this.node, 1.0);
|
||||
|
||||
// 升级时同步更新描边
|
||||
if (this.model) {
|
||||
let flashSprite = this.node.getComponent(FlashSprite);
|
||||
if (!flashSprite) {
|
||||
flashSprite = this.node.getComponentInChildren(FlashSprite);
|
||||
}
|
||||
if (flashSprite) {
|
||||
flashSprite.setOutlineByLevel(this.model.lv);
|
||||
}
|
||||
this.applyOutlineByLevel();
|
||||
}
|
||||
|
||||
/** 按英雄等级应用描边(升级/初始化共用入口) */
|
||||
private applyOutlineByLevel() {
|
||||
if (!this.model) return;
|
||||
const flashSprite = this.getFlashSprite();
|
||||
if (flashSprite) {
|
||||
flashSprite.setOutlineByLevel(this.model.lv);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 按 Boss 阶段应用描边(P2 绿 / P3 红)
|
||||
* Why: 由 BossPhaseSystem 直接调用,不走英雄 HeroLvUp 事件语义
|
||||
* (Boss 是 MON 阵营,且对象池节点挂全局监听易漏注销)
|
||||
* @param phase 阶段索引:1=P2 / 2=P3
|
||||
*/
|
||||
public applyBossPhaseOutline(phase: number) {
|
||||
const flashSprite = this.getFlashSprite();
|
||||
if (flashSprite) {
|
||||
flashSprite.setOutlineByBossPhase(phase);
|
||||
}
|
||||
}
|
||||
|
||||
/** 查找 FlashSprite 组件(优先自身,回退子节点),描边三处调用点统一入口 */
|
||||
private getFlashSprite(): FlashSprite | null {
|
||||
return this.node.getComponent(FlashSprite) ?? this.node.getComponentInChildren(FlashSprite);
|
||||
}
|
||||
|
||||
/** 攻击力提升特效 */
|
||||
private ap_up() {
|
||||
this.spawnTimedFx("game/skill/buff/buff_apup", this.node, 1.0);
|
||||
|
||||
Reference in New Issue
Block a user