fix(hero): 修复血条显示逻辑,区分加血和扣血动画
refactor(map): 优化地图预制体结构,移除无用节点 style(assets): 更新资源文件和元数据配置
This commit is contained in:
@@ -199,10 +199,25 @@ export class HeroViewComp extends CCComp {
|
||||
let hp=this.model.hp;
|
||||
let hp_max=this.model.Attrs[Attrs.HP_MAX];
|
||||
this.debugLog("hp_show",hp,hp_max)
|
||||
this.top_node.getChildByName("hp").getComponent(ProgressBar).progress = hp / hp_max;;
|
||||
this.scheduleOnce(() => {
|
||||
this.top_node.getChildByName("hp").getChildByName("hpb").getComponent(ProgressBar).progress = hp / hp_max;;
|
||||
}, 0.15);
|
||||
|
||||
let targetProgress = hp / hp_max;
|
||||
let hpNode = this.top_node.getChildByName("hp");
|
||||
let hpProgressBar = hpNode.getComponent(ProgressBar);
|
||||
let hpbProgressBar = hpNode.getChildByName("hpb").getComponent(ProgressBar);
|
||||
|
||||
if (targetProgress < hpProgressBar.progress) {
|
||||
// 扣血:先扣血(hp),再跟(hpb)
|
||||
hpProgressBar.progress = targetProgress;
|
||||
this.scheduleOnce(() => {
|
||||
if(hpbProgressBar && hpbProgressBar.isValid) hpbProgressBar.progress = targetProgress;
|
||||
}, 0.15);
|
||||
} else {
|
||||
// 加血:先加底(hpb),再加血(hp)
|
||||
hpbProgressBar.progress = targetProgress;
|
||||
this.scheduleOnce(() => {
|
||||
if(hpProgressBar && hpProgressBar.isValid) hpProgressBar.progress = targetProgress;
|
||||
}, 0.15);
|
||||
}
|
||||
}
|
||||
|
||||
/** 显示魔法值 */
|
||||
|
||||
Reference in New Issue
Block a user