From a9e7b5c464b4c38d2b00e028cfeba966be62519c Mon Sep 17 00:00:00 2001 From: walkpan Date: Fri, 2 Jan 2026 19:28:43 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E8=8B=B1=E9=9B=84):=20=E6=B7=BB=E5=8A=A0i?= =?UTF-8?q?s=5Fmaster=E5=8F=82=E6=95=B0=E6=8E=A7=E5=88=B6=E8=8B=B1?= =?UTF-8?q?=E9=9B=84=E4=B8=BB=E4=BB=8E=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修改Hero类的load方法和MissionHeroComp类的addHero方法,增加is_master参数 用于区分主控英雄和从属英雄,取代之前硬编码的true值 --- assets/script/game/hero/Hero.ts | 4 ++-- assets/script/game/map/MissionHeroComp.ts | 8 +++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/assets/script/game/hero/Hero.ts b/assets/script/game/hero/Hero.ts index f4f64659..05083281 100644 --- a/assets/script/game/hero/Hero.ts +++ b/assets/script/game/hero/Hero.ts @@ -37,7 +37,7 @@ export class Hero extends ecs.Entity { /** 加载角色 */ - load(pos: Vec3 = Vec3.ZERO,scale:number = 1,uuid:number=1001,fight_pos:number=1) { + load(pos: Vec3 = Vec3.ZERO,scale:number = 1,uuid:number=1001,fight_pos:number=1,is_master:boolean=false) { // console.log("英雄加载:",uuid,pos,scale,info) scale = 1 // 查找空闲英雄槽位 @@ -72,7 +72,7 @@ export class Hero extends ecs.Entity { model.lv = hero.lv ? hero.lv : 1; model.type = hero.type; model.fac = FacSet.HERO; - model.is_master = true; + model.is_master = is_master; // ✅ 初始化技能数据(迁移到 HeroSkillsComp) skillsComp.initSkills(hero.skills, uuid, this); diff --git a/assets/script/game/map/MissionHeroComp.ts b/assets/script/game/map/MissionHeroComp.ts index 1f88e1f5..695448cb 100644 --- a/assets/script/game/map/MissionHeroComp.ts +++ b/assets/script/game/map/MissionHeroComp.ts @@ -42,7 +42,7 @@ export class MissionHeroCompComp extends CCComp { // this.current_hero_uuid=0 smc.vmdata.mission_data.hero_num=0 // console.log("[MissionHeroComp]:fight_ready",smc.fight_heros,Object.keys(smc.fight_heros).length) - this.addHero(smc.fight_hero,false) + this.addHero(smc.fight_hero,true) // for(let i=0;i(Hero); let scale = 1 let pos:Vec3 = HeroPos[hero_pos].pos; - hero.load(pos,scale,uuid); + let fight_pos=1 + + hero.load(pos,scale,uuid,fight_pos,is_master); }