fix: 修复BOSS技能配置错误并优化血条震动逻辑

- 将BOSS(兽人首领)的技能从[6001,6003]更正为[6002,6004],以匹配设计意图
- 重构血条震动逻辑,将震动目标从hp子节点改为顶层top节点,提升稳定性
- 在组件销毁时增加对top节点缓动的清理,避免残留动画
This commit is contained in:
panw
2026-03-19 15:22:59 +08:00
parent b90b688289
commit a2e3dd4924
2 changed files with 12 additions and 11 deletions

View File

@@ -204,5 +204,5 @@ export const HeroInfo: Record<number, heroInfo> = {
type:HType.Melee,lv:1,hp:150,ap:10,speed:110,skills:[6001,6003],info:"战术目标:提供加速光环,改变怪群推进节奏"},
// 6. 精英/BOSS型
5701:{uuid:5701,name:"兽人首领(BOSS)",icon:"1001",path:"mo4", fac:FacSet.MON, kind:1,as:2.5,ss:10,
type:HType.Melee,lv:3,hp:2000,ap:60,speed:120,skills:[6001,6003],info:"终极考验极高HP检测大招重置与辐射协同输出"},
type:HType.Melee,lv:3,hp:2000,ap:60,speed:120,skills:[6002,6004],info:"终极考验极高HP检测大招重置与辐射协同输出"},
};

View File

@@ -41,7 +41,7 @@ export class HeroViewComp extends CCComp {
// ==================== UI 节点引用 ====================
private top_node: Node = null!;
private topOpacity: UIOpacity = null!;
private hpBarBasePos: Vec3 = v3();
private topBasePos: Vec3 = v3();
private readonly barIdleOpacity: number = 153;
private readonly barActiveOpacity: number = 255;
private readonly idleOpacityDelay: number = 0.25;
@@ -114,10 +114,8 @@ export class HeroViewComp extends CCComp {
private initUINodes() {
this.top_node = this.node.getChildByName("top");
this.topOpacity = this.top_node.getComponent(UIOpacity) || this.top_node.addComponent(UIOpacity);
this.topBasePos = this.top_node.position.clone();
const hpNode = this.top_node.getChildByName("hp");
if (hpNode) {
this.hpBarBasePos = hpNode.position.clone();
}
if(this.model.fac==FacSet.HERO){
hpNode.getChildByName("Bar").getComponent(Sprite).color=new Color("#2ECC71")
}
@@ -224,17 +222,16 @@ export class HeroViewComp extends CCComp {
}
private playHpBarShake() {
const hpNode = this.top_node?.getChildByName("hp");
if (!hpNode || !hpNode.isValid) return;
Tween.stopAllByTarget(hpNode);
hpNode.setPosition(this.hpBarBasePos);
tween(hpNode)
if (!this.top_node || !this.top_node.isValid) return;
Tween.stopAllByTarget(this.top_node);
this.top_node.setPosition(this.topBasePos);
tween(this.top_node)
.by(0.04, { position: v3(-3, 0, 0) })
.by(0.04, { position: v3(6, 0, 0) })
.by(0.04, { position: v3(-5, 0, 0) })
.by(0.04, { position: v3(2, 0, 0) })
.call(() => {
hpNode.setPosition(this.hpBarBasePos);
this.top_node.setPosition(this.topBasePos);
})
.start();
}
@@ -601,6 +598,10 @@ export class HeroViewComp extends CCComp {
// 清理残留的定时器和缓动
this.unscheduleAllCallbacks();
Tween.stopAllByTarget(this.node);
if (this.top_node && this.top_node.isValid) {
Tween.stopAllByTarget(this.top_node);
this.top_node.setPosition(this.topBasePos);
}
// 清理碰撞器事件监听
const collider = this.getComponent(Collider2D);