style(hero): 调整英雄血条UI参数与显示逻辑

1. 调整hp_height和boss_hp_height参数,优化血条显示高度
2. 修复top_node血条方向随对象池复用导致反转的问题
3. 更新血条预制体的尺寸、样式与贴图配置
This commit is contained in:
pan
2026-07-21 16:38:43 +08:00
parent 5d55f3bdb1
commit 4f95accfbf
2 changed files with 25 additions and 21 deletions

View File

@@ -38,8 +38,8 @@ export class HeroViewComp extends CCComp {
realDeadTime: number = 0.1
deadCD: number = 0
monDeadTime: number = 0.1
hp_height: number = 70
boss_hp_height: number = 140
hp_height: number = 90
boss_hp_height: number = 160
// 血条显示相关
lastBarUpdateTime: number = 0; // 最后一次血条/蓝条/护盾更新时间
// ==================== UI 节点引用 ====================
@@ -117,7 +117,8 @@ export class HeroViewComp extends CCComp {
/** 方向 */
this.node.setScale(this.scale * Math.abs(this.node.scale.x), 1 * this.node.scale.y); // 确保 scale.x 为正后再乘方向
this.top_node.setScale(this.scale * this.top_node.scale.x, 1 * this.top_node.scale.y);
// top_node 取 abs 避免对象池复用时 scale 累乘导致血条方向反转
this.top_node.setScale(this.scale * Math.abs(this.top_node.scale.x), 1 * this.top_node.scale.y);
/* 显示角色血*/
this.top_node.getChildByName("hp").active = true;
this.top_node.getChildByName("cd").active = false;