From a2e3dd4924aeb199b9d3763fa5d6ba2dd6c5cb81 Mon Sep 17 00:00:00 2001 From: panw Date: Thu, 19 Mar 2026 15:22:59 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8DBOSS=E6=8A=80=E8=83=BD?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E9=94=99=E8=AF=AF=E5=B9=B6=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E8=A1=80=E6=9D=A1=E9=9C=87=E5=8A=A8=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 将BOSS(兽人首领)的技能从[6001,6003]更正为[6002,6004],以匹配设计意图 - 重构血条震动逻辑,将震动目标从hp子节点改为顶层top节点,提升稳定性 - 在组件销毁时增加对top节点缓动的清理,避免残留动画 --- assets/script/game/common/config/heroSet.ts | 2 +- assets/script/game/hero/HeroViewComp.ts | 21 +++++++++++---------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/assets/script/game/common/config/heroSet.ts b/assets/script/game/common/config/heroSet.ts index 3c95b608..643f12c9 100644 --- a/assets/script/game/common/config/heroSet.ts +++ b/assets/script/game/common/config/heroSet.ts @@ -204,5 +204,5 @@ export const HeroInfo: Record = { 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,检测大招重置与辐射协同输出"}, }; diff --git a/assets/script/game/hero/HeroViewComp.ts b/assets/script/game/hero/HeroViewComp.ts index 6a40496d..cdd45cc3 100644 --- a/assets/script/game/hero/HeroViewComp.ts +++ b/assets/script/game/hero/HeroViewComp.ts @@ -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);