refactor(hero): 移除护盾进度条显示逻辑
简化护盾显示逻辑,不再显示护盾进度条,仅控制护盾节点的激活状态。 同时简化满血判断逻辑,移除护盾检查。
This commit is contained in:
@@ -166,11 +166,8 @@ export class HeroViewComp extends CCComp {
|
||||
/** 显示护盾 */
|
||||
private show_shield(shield: number = 0, shield_max: number = 0) {
|
||||
this.lastBarUpdateTime = Date.now() / 1000;
|
||||
let shield_progress = shield / shield_max;
|
||||
this.node.getChildByName("shielded").active = shield > 0;
|
||||
this.top_node.getChildByName("shield").active = shield > 0;
|
||||
this.top_node.getChildByName("shield").getComponent(ProgressBar).progress = shield_progress;
|
||||
this.setTopBarOpacity(false);
|
||||
void shield_max;
|
||||
}
|
||||
|
||||
/** 显示血量 */
|
||||
@@ -200,9 +197,7 @@ export class HeroViewComp extends CCComp {
|
||||
private isFullHpAndNoShield(): boolean {
|
||||
if (!this.model) return false;
|
||||
if (this.model.hp_max <= 0) return false;
|
||||
const isFullHp = this.model.hp >= this.model.hp_max;
|
||||
const noShield = this.model.shield <= 0;
|
||||
return isFullHp && noShield;
|
||||
return this.model.hp >= this.model.hp_max;
|
||||
}
|
||||
|
||||
private setTopBarOpacity(isActive: boolean) {
|
||||
|
||||
Reference in New Issue
Block a user