This commit is contained in:
2025-01-08 23:59:41 +08:00
parent aa2d915bb3
commit 52cc268368
9 changed files with 213 additions and 142 deletions

View File

@@ -234,20 +234,42 @@ export class MissionComp extends CCComp {
return ecs.query(ecs.allOf(HeroModelComp))
}
count_mon_pos(){
let right_x:number=360
let left_x:number=-360
let monsters:any= this.get_mons()
for(let i=0;i<monsters.length;i++){
if(monsters[i].HeroView == undefined) return
let mon:any = monsters[i].HeroView.node.position
smc.enemy_pos[i]= mon
if(monsters[i].HeroView.node.position.x > left_x){
left_x = monsters[i].HeroView.node.position.x
}
if(monsters[i].HeroView.node.position.x < right_x){
right_x = monsters[i].HeroView.node.position.x
}
}
smc.mon_front_x=right_x
smc.mon_back_x=left_x
// console.log("count_mon_pos",smc.mon_pos,smc.mon_front_x,smc.mon_back_x)
}
count_hero_pos(){
let right_x:number=360
let left_x:number=-360
let heros:any= this.get_heros()
for(let i=0;i<heros.length;i++){
if(heros[i].HeroView == undefined) return
let ho:any = heros[i].HeroView.node.position
smc.hero_pos[i]= ho
if(heros[i].HeroView.node.position.x > left_x){
left_x = heros[i].HeroView.node.position.x
}
if(heros[i].HeroView.node.position.x < right_x){
right_x = heros[i].HeroView.node.position.x
}
}
smc.hero_front_x=left_x
smc.hero_back_x=right_x
// console.log("count_hero_pos",smc.hero_pos,smc.hero_front_x,smc.mon_front_x)
}
mon_refresh(){