改了 好多
This commit is contained in:
@@ -46,29 +46,17 @@ export class Hero extends ecs.Entity {
|
||||
node.parent = scene.entityLayer!.node!
|
||||
let pos=HeroPos[0].pos
|
||||
node.setPosition(pos)
|
||||
var hv = node.getComponent(HeroViewComp)!;
|
||||
let hero= HeroInfo[uuid] // 共用英雄数据
|
||||
var hv = this.hero_init(uuid,node)
|
||||
hv.scale = 1;
|
||||
hv.fac = FacSet.HERO;
|
||||
hv.is_master=true;
|
||||
hv.type = hero.type;
|
||||
hv.box_group = box_group;
|
||||
hv.hero_uuid= uuid;
|
||||
hv.hero_name= hero.name;
|
||||
hv.speed =hv.ospeed = hero.speed;
|
||||
hv.dis = hero.dis;
|
||||
hv.hp= hv.hp_max =hero.hp;
|
||||
hv.ap = hero.ap;
|
||||
hv.lv=1
|
||||
hv.cd = hero.a_cd
|
||||
hv.hp_up=hero.hp_up
|
||||
hv.atk_skill=hero.skills[0]
|
||||
console.log(hv.hero_name+"dis=>"+hv.dis)
|
||||
this.add(hv);
|
||||
this.addComponents<ecs.Comp>(MasterModelComp)
|
||||
console.log("[Hero]:master",hv)
|
||||
|
||||
}
|
||||
/** 加载角色 */
|
||||
load(pos: Vec3 = Vec3.ZERO,scale:number = 1,uuid:number=1001,info:any={ap:0,hp:0},fight_pos:number=1) {
|
||||
load(pos: Vec3 = Vec3.ZERO,scale:number = 1,uuid:number=1001,info:any={ap:0,hp:0,lv:1,crt:0,crt_d:0,dod:0,dod_no:false,crt_no:false},fight_pos:number=1) {
|
||||
// console.log("英雄加载:",uuid,pos,scale,info)
|
||||
scale = 1
|
||||
let box_group=BoxSet.HERO
|
||||
@@ -79,29 +67,39 @@ export class Hero extends ecs.Entity {
|
||||
node.parent = scene.entityLayer!.node!
|
||||
node.setPosition(pos)
|
||||
// console.log("hero load",pos)
|
||||
var hv = this.hero_init(uuid,node,info)
|
||||
hv.fight_pos=fight_pos
|
||||
this.add(hv);
|
||||
this.addComponents<ecs.Comp>(FriendModelComp);
|
||||
// const move = this.get(BattleMoveComp);
|
||||
// move.direction = 1; // 向右移动
|
||||
// move.targetX = 800; // 右边界'
|
||||
oops.message.dispatchEvent("hero_load",this)
|
||||
console.log("[Hero]:friend",hv)
|
||||
|
||||
}
|
||||
hero_init(uuid:number=1001,node:Node,info:any={ap:0,hp:0,lv:1,crt:0,crt_d:0,dod:0,dod_no:false,crt_no:false}) {
|
||||
var hv = node.getComponent(HeroViewComp)!;
|
||||
let hero= HeroInfo[uuid] // 共用英雄数据
|
||||
hv.scale = scale;
|
||||
hv.scale = 1;
|
||||
hv.lv=info.lv
|
||||
hv.fac = FacSet.HERO;
|
||||
hv.fight_pos=fight_pos
|
||||
hv.type = hero.type;
|
||||
hv.box_group = box_group;
|
||||
hv.box_group = BoxSet.HERO;
|
||||
hv.hero_uuid= uuid;
|
||||
hv.hero_name= hero.name;
|
||||
hv.speed =hv.ospeed = hero.speed;
|
||||
hv.dis = hero.dis;
|
||||
hv.hp= hv.hp_max =hero.hp+info.hp;
|
||||
hv.ap = hero.ap+info.ap;
|
||||
hv.lv=info.lv+1
|
||||
hv.cd = hero.a_cd
|
||||
hv.hp_up=hero.hp_up
|
||||
hv.hp= hv.hp_max =hero.hp+info.hp
|
||||
hv.ap = hero.ap+info.ap;
|
||||
hv.crt=hero.crt+info.crt
|
||||
hv.crt_d=hero.crt_d+info.crt_d
|
||||
hv.dod=hero.dod+info.dod
|
||||
hv.dod_no=info.dod_no
|
||||
hv.crt_no=info.crt_no
|
||||
hv.atk_skill=hero.skills[0]
|
||||
this.add(hv);
|
||||
this.addComponents<ecs.Comp>(FriendModelComp);
|
||||
const move = this.get(BattleMoveComp);
|
||||
move.direction = 1; // 向右移动
|
||||
move.targetX = 800; // 右边界'
|
||||
oops.message.dispatchEvent("hero_load",this)
|
||||
return hv
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user