This commit is contained in:
walkpan
2024-11-20 23:58:07 +08:00
parent a0f89d8a90
commit 76d7e6677c
52 changed files with 1940 additions and 6355 deletions

View File

@@ -20,6 +20,7 @@ export class HCardComp extends CCComp {
hp:any=[]
life:any=[]
pw:any=[]
is_dead:boolean=false
protected onLoad(): void {
@@ -36,11 +37,21 @@ export class HCardComp extends CCComp {
console.log("hcard start")
}
protected update(dt: number): void {
if(this.is_dead) return
if(this.heros[this.hi].HeroView.is_dead){
this.node.getChildByName("dead").active=true
this.node.getChildByName("bg").getComponent(Sprite).grayscale=true
this.is_dead=true
}else{
this.node.getChildByName("dead").active=false
this.node.getChildByName("bg").getComponent(Sprite).grayscale=false
this.is_dead=false
}
this.hp.string=this.heros[this.hi].HeroView.hp_max
this.ap.string=this.heros[this.hi].HeroView.ap
this.life.progress=this.heros[this.hi].HeroView.hp/this.heros[this.hi].HeroView.hp_max
this.pw.progress=this.heros[this.hi].HeroView.pw/this.heros[this.hi].HeroView.pwm
}
/** 视图对象通过 ecs.Entity.remove(ControllerComp) 删除组件是触发组件处理自定义释放逻辑 */
reset() {