修改mon 、hero的位置更新方法,多线改为单线
This commit is contained in:
@@ -189,51 +189,18 @@ export class MapMonsterComp extends CCComp {
|
||||
}
|
||||
count_mon_pos(){
|
||||
let monsters:any= ecs.query(ecs.allOf(MonModelComp));
|
||||
smc.enemy_pos[0].x=320
|
||||
smc.enemy_pos[1].x=320
|
||||
smc.enemy_pos[2].x=320
|
||||
for(let i=0;i<monsters.length;i++){
|
||||
if(monsters[i].MonView == undefined) return
|
||||
let mon:any = monsters[i].MonView.node.position
|
||||
if(mon.x < smc.enemy_pos[0].x&&mon.y == smc.enemy_pos[0].y){
|
||||
smc.enemy_pos[0].x = mon.x
|
||||
continue
|
||||
}
|
||||
if(mon.x < smc.enemy_pos[1].x&&mon.y == smc.enemy_pos[1].y){
|
||||
smc.enemy_pos[1].x = mon.x
|
||||
continue
|
||||
}
|
||||
if(mon.x < smc.enemy_pos[2].x&&mon.y == smc.enemy_pos[2].y){
|
||||
smc.enemy_pos[2].x = mon.x
|
||||
continue
|
||||
}
|
||||
smc.enemy_pos[i].x= mon.x
|
||||
}
|
||||
}
|
||||
count_hero_pos(){
|
||||
let heros:any= ecs.query(ecs.allOf(HeroModelComp));
|
||||
smc.hero_pos[0].x=-320
|
||||
smc.hero_pos[1].x=-320
|
||||
smc.hero_pos[2].x=-320
|
||||
for(let i=0;i<heros.length;i++){
|
||||
if(heros[i].RoleView != undefined){
|
||||
smc.hero_pos[5].x = heros[i].RoleView.node.position.x
|
||||
smc.hero_pos[5].y = heros[i].RoleView.node.position.y
|
||||
continue
|
||||
}
|
||||
if(heros[i].HeroView == undefined) return
|
||||
let ho:any = heros[i].HeroView.node.position
|
||||
if(ho.x > smc.hero_pos[0].x&&ho.y == smc.hero_pos[0].y){
|
||||
smc.hero_pos[0].x = ho.x
|
||||
continue
|
||||
}
|
||||
if(ho.x > smc.hero_pos[0].x&&ho.y == smc.hero_pos[1].y ){
|
||||
smc.hero_pos[1].x = ho.x
|
||||
continue
|
||||
}
|
||||
if(ho.x > smc.hero_pos[0].x&&ho.y == smc.hero_pos[2].y){
|
||||
smc.hero_pos[2].x = ho.x
|
||||
continue
|
||||
}
|
||||
smc.hero_pos[i].x= ho.x
|
||||
}
|
||||
// console.log("count_hero_pos",smc.hero_pos);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user