From 02547cb47055238efb303a1cef4129a15a36889e Mon Sep 17 00:00:00 2001 From: panw Date: Thu, 24 Apr 2025 10:49:50 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/script/game/map/MissionHeroComp.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/assets/script/game/map/MissionHeroComp.ts b/assets/script/game/map/MissionHeroComp.ts index 2186bd60..8e817e79 100644 --- a/assets/script/game/map/MissionHeroComp.ts +++ b/assets/script/game/map/MissionHeroComp.ts @@ -52,7 +52,6 @@ export class MissionHeroCompComp extends CCComp { /** 添加玩家 */ private addHero(uuid:number=1001) { - let heros=ecs.query(ecs.allOf(HeroModelComp)) console.log("call_hero addHero",uuid) let info:any={ap:0,hp:0} if(this.start_pos[HeroInfo[uuid].type].has){ @@ -65,11 +64,11 @@ export class MissionHeroCompComp extends CCComp { hero.load(pos,scale,uuid,info); this.start_pos[HeroInfo[uuid].type].has=true } - remove_hero(i:number){ + remove_hero(type:number){ let info:any={ap:0,hp:0} let heros=ecs.query(ecs.allOf(HeroModelComp)) for(let hero of heros){ - if(hero.get(HeroViewComp).node.position.x==HeroPos[i].pos.x){ + if(hero.get(HeroViewComp).type==type){ info.ap=hero.get(HeroViewComp).ap*(100+hero.get(HeroViewComp).r_up)/100 info.hp=hero.get(HeroViewComp).hp*(100+hero.get(HeroViewComp).r_up)/100 hero.destroy()