战斗信息显示

This commit is contained in:
2025-04-24 13:52:44 +08:00
parent 28b557f18f
commit dcc1a98b3b
3 changed files with 796 additions and 5 deletions

View File

@@ -89,8 +89,8 @@ export class HeroViewComp extends CCComp {
onLoad() {
this.as = this.getComponent(HeroSpine);
let anm = this.node.getChildByName("anm")
anm.setScale(anm.scale.x*0.8,anm.scale.y*0.8);
// let anm = this.node.getChildByName("anm")
// anm.setScale(anm.scale.x*0.8,anm.scale.y*0.8);
// 注册单个碰撞体的回调函数
// let collider = this.getComponent(Collider2D);
@@ -149,6 +149,10 @@ export class HeroViewComp extends CCComp {
get isActive() {
return this.ent.has(HeroViewComp) && this.node?.isValid;
}
hide_info(){
this.node.getChildByName("top").getChildByName("ihp").active = false;
this.node.getChildByName("top").getChildByName("iap").active = false;
}
hp_show(){
let hp_progress= this.hp/this.hp_max;
this.node.getChildByName("top").getChildByName("hp").getComponent(ProgressBar)!.progress = hp_progress;

View File

@@ -50,6 +50,7 @@ export class Monster extends ecs.Entity {
hero_init(uuid:number=1001,node:Node,scale:number=1,box_group=BoxSet.HERO,is_boss:boolean=false,is_call:boolean=false,lv:number=1) {
var hv = node.getComponent(HeroViewComp)!;
hv.hide_info()
// console.log("hero_init",buff)
let hero= HeroInfo[uuid] // 共用英雄数据
hv.scale = scale;