假期修改
This commit is contained in:
@@ -36,7 +36,9 @@ export class MapMonsterComp extends CCComp {
|
||||
target_timer: Timer = new Timer(0.1);
|
||||
setp_num:number = 5;
|
||||
game_over:boolean = false;
|
||||
start_ys:any[] = [100,50,0,-50,-100];
|
||||
start_ys:any[] = [70,0,-70];
|
||||
hero_start_ys:any[] = [35,-35];
|
||||
|
||||
onLoad(){
|
||||
// 监听全局事件
|
||||
oops.message.on("other_add_monster", this.on_other_add_monster, this);
|
||||
@@ -95,11 +97,26 @@ export class MapMonsterComp extends CCComp {
|
||||
private addHero(uuid:number=1001) {
|
||||
let hero = ecs.getEntity<Hero>(Hero);
|
||||
var scene = smc.map.MapView.scene;
|
||||
let oy=RandomManager.instance.getRandomByObjectList(this.start_ys,1)
|
||||
let pos:Vec3 = v3(BoxSet.HERO_START,BoxSet.GAME_LINE+oy[0]);
|
||||
let oy=RandomManager.instance.getRandomInt(-70,70,1)
|
||||
let pos = v3(0,0);
|
||||
let less=0
|
||||
let index =0
|
||||
for(let i=0; i <= 11;i++){
|
||||
if(smc.role_heros[i].eid==0){
|
||||
pos=v3(smc.role_heros[i].x,smc.role_heros[i].y)
|
||||
less += 1
|
||||
index = i
|
||||
smc.role_heros[i].eid=hero.eid
|
||||
break
|
||||
}
|
||||
}
|
||||
if(less <= 0){
|
||||
oops.gui.toast("人数已满");
|
||||
return false
|
||||
}
|
||||
let monster_layer = scene.entityLayer!.node!
|
||||
let scale = 1
|
||||
hero.load(pos,scale,uuid,monster_layer);
|
||||
hero.load(pos,scale,uuid,monster_layer,index);
|
||||
}
|
||||
monster_refresh(){
|
||||
if (this.setp_num <= 0){
|
||||
@@ -107,8 +124,8 @@ export class MapMonsterComp extends CCComp {
|
||||
}
|
||||
let m:any = RandomManager.instance.getRandomByObjectList(this.mission_list[this.monster_level],1)
|
||||
var scene = smc.map.MapView.scene;
|
||||
let oy=RandomManager.instance.getRandomByObjectList(this.start_ys,1)
|
||||
let pos:Vec3 = v3(BoxSet.MONSTER_START,BoxSet.GAME_LINE+oy[0])
|
||||
let oy=RandomManager.instance.getRandomInt(-70,70,1)
|
||||
let pos:Vec3 = v3(BoxSet.MONSTER_START,BoxSet.GAME_LINE+oy)
|
||||
let monster_layer = scene.entityLayer!.node!
|
||||
this.addMonster(m[0],monster_layer,pos)
|
||||
this.setp_num -= 1
|
||||
|
||||
Reference in New Issue
Block a user