fix(英雄属性): 修复MP更新时视图未同步的问题

修改HeroAttrsComp在更新MP值时调用HeroViewComp的mp_add方法同步视图
重命名HeroViewComp的mp方法为mp_add以更准确描述其功能
移除HeroViewComp中未使用的pow_show方法
This commit is contained in:
2025-11-26 10:14:06 +08:00
parent ab4d29d42b
commit df3ad88c3e
2 changed files with 6 additions and 8 deletions

View File

@@ -137,6 +137,10 @@ export class HeroAttrsComp extends ecs.Comp {
if(!isValue){
addValue = value * this.Attrs[Attrs.MP_MAX];
}
let heroView = this.ent.get(HeroViewComp);
if(heroView){
heroView.mp_add(addValue);
}
this.mp += addValue;
this.mp = Math.max(0, Math.min(this.mp, this.Attrs[Attrs.MP_MAX]));
}