位置已取消
This commit is contained in:
@@ -29,7 +29,7 @@ export class Hero extends ecs.Entity {
|
||||
}
|
||||
|
||||
/** 加载角色 */
|
||||
load(pos: Vec3 = Vec3.ZERO,scale:number = 1,uuid:number=1001,info:any={ap:0,hp:0}) {
|
||||
load(pos: Vec3 = Vec3.ZERO,scale:number = 1,uuid:number=1001,info:any={ap:0,hp:0},fight_pos:number=0) {
|
||||
console.log("英雄加载:",uuid,pos,scale,info)
|
||||
scale = 1
|
||||
let box_group=BoxSet.HERO
|
||||
@@ -44,6 +44,7 @@ export class Hero extends ecs.Entity {
|
||||
let hero= HeroInfo[uuid] // 共用英雄数据
|
||||
hv.scale = scale;
|
||||
hv.fac = 0;
|
||||
hv.fight_pos=fight_pos
|
||||
hv.type = hero.type;
|
||||
hv.box_group = box_group;
|
||||
hv.hero_uuid= uuid;
|
||||
|
||||
@@ -29,6 +29,7 @@ export class HeroViewComp extends CCComp {
|
||||
|
||||
hero_uuid:number = 1001;
|
||||
hero_name : string = "hero";
|
||||
fight_pos:number=0;
|
||||
lv:number =1;
|
||||
slv:number =1;
|
||||
scale: number = 1; /** 角色阵营 1:hero -1 :mon */
|
||||
|
||||
@@ -51,39 +51,36 @@ export class MissionHeroCompComp extends CCComp {
|
||||
call_hero(event: string, args: any){
|
||||
this.node.getChildByName("herospos").active=false
|
||||
console.log("call_hero",args)
|
||||
let hero_pos=0
|
||||
if(args.hero_pos){
|
||||
hero_pos=args.hero_pos
|
||||
}
|
||||
let fight_pos=args
|
||||
this.timer.reset()
|
||||
let hero_list =HeroList
|
||||
let x=RandomManager.instance.getRandomInt(0,hero_list.length,1)
|
||||
// let uuid=args.uuid
|
||||
// console.log("call_hero",uuid)
|
||||
this.addHero(this.current_hero_uuid,hero_pos)
|
||||
this.addHero(this.current_hero_uuid,fight_pos)
|
||||
}
|
||||
|
||||
/** 添加玩家 */
|
||||
private addHero(uuid:number=1001,hero_pos:number=0) {
|
||||
private addHero(uuid:number=1001,fight_pos:number=0) {
|
||||
console.log("call_hero addHero",uuid)
|
||||
let info:any={ap:0,hp:0}
|
||||
if(this.start_pos[hero_pos].has){
|
||||
info=this.get_info_and_remove(hero_pos,uuid)
|
||||
if(this.start_pos[fight_pos].has){
|
||||
info=this.get_info_and_remove(fight_pos,uuid)
|
||||
}
|
||||
let hero = ecs.getEntity<Hero>(Hero);
|
||||
let scale = 1
|
||||
let pos:Vec3 = this.start_pos[hero_pos].pos;
|
||||
let pos:Vec3 = this.start_pos[fight_pos].pos;
|
||||
console.log("hero load0",pos,this.start_pos)
|
||||
hero.load(pos,scale,uuid,info);
|
||||
this.start_pos[hero_pos].has=true
|
||||
hero.load(pos,scale,uuid,info,fight_pos);
|
||||
this.start_pos[fight_pos].has=true
|
||||
this.current_hero_uuid=0
|
||||
}
|
||||
|
||||
get_info_and_remove(type:number,uuid:number){
|
||||
get_info_and_remove(fight_pos:number,uuid:number){
|
||||
let info:any={ap:0,hp:0}
|
||||
let heros=ecs.query(ecs.allOf(HeroModelComp))
|
||||
for(let hero of heros){
|
||||
if(hero.get(HeroViewComp).type==type){
|
||||
if(hero.get(HeroViewComp).fight_pos==fight_pos){
|
||||
let hv = hero.get(HeroViewComp)
|
||||
let AP_UP_RATE = hv.hero_uuid === uuid ? GameSet.AP_UPDATE_RATE : GameSet.AP_CHANGE_RATE;
|
||||
let heroUpData = HeroUpInfo[hv.hero_uuid] || {}
|
||||
|
||||
Reference in New Issue
Block a user