dd
This commit is contained in:
@@ -44,6 +44,7 @@ export class MissionComp extends CCComp {
|
||||
MSComp:MSkillComp=null
|
||||
MMSComp:MSkillComp=null
|
||||
|
||||
|
||||
onLoad(){
|
||||
// this.MSComp=this.node.getChildByName("msk").getComponent(MSkillComp)
|
||||
// this.MMSComp=this.node.getChildByName("mmsk").getComponent(MSkillComp)
|
||||
@@ -65,7 +66,6 @@ export class MissionComp extends CCComp {
|
||||
}
|
||||
this.count_hero_pos()
|
||||
this.count_mon_pos()
|
||||
this.check_buff()
|
||||
// if (this.game_timer.update(dt)) {
|
||||
// smc.vmdata.game.g_time += 1;
|
||||
// }
|
||||
@@ -77,20 +77,15 @@ export class MissionComp extends CCComp {
|
||||
this.colose_victory()
|
||||
this.mission_init()
|
||||
// this.mskill_init()
|
||||
this.mon_refresh()
|
||||
this.heros_call()
|
||||
}
|
||||
|
||||
mission_end(){
|
||||
oops.message.dispatchEvent(GameEvent.MissionEnd)
|
||||
smc.mission.play=false
|
||||
smc.mission.pause=false
|
||||
|
||||
this.cleanComponents()
|
||||
// this.to_mission_home()
|
||||
this.open_victory()
|
||||
|
||||
|
||||
}
|
||||
private cleanComponents() {
|
||||
ecs.query(ecs.allOf(HeroSkillsComp)).forEach(entity => {entity.remove(HeroSkillsComp);entity.destroy()});
|
||||
@@ -119,31 +114,13 @@ export class MissionComp extends CCComp {
|
||||
smc.vmdata.mission.mexp=0 //敌方局内经验
|
||||
smc.vmdata.mission.exp_max= smc.vmdata.mission.mexp_max=MBSet.exp
|
||||
}
|
||||
clear_x1(){
|
||||
for (let i in smc.items) {
|
||||
smc.items[i].x1=0
|
||||
}
|
||||
// for (let i in smc.skills) {
|
||||
// smc.skills[i].x1=0
|
||||
// }
|
||||
for (let i in smc.heros) {
|
||||
smc.heros[i].x1=0
|
||||
}
|
||||
// console.log("clear_x1",smc.items,smc.heros)
|
||||
}
|
||||
|
||||
mskill_init(){
|
||||
this.MSComp.group=BoxSet.HERO
|
||||
this.MMSComp.group=BoxSet.MONSTER
|
||||
this.MSComp.init()
|
||||
this.MMSComp.init()
|
||||
}
|
||||
check_buff(){
|
||||
if(smc.vmdata.mission.exp >= smc.vmdata.mission.exp_max){
|
||||
smc.vmdata.mission.exp-=smc.vmdata.mission.exp_max
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
check_mon_num(){
|
||||
let mons:any = this.get_mons()
|
||||
let heros:any= this.get_heros()
|
||||
@@ -209,73 +186,10 @@ export class MissionComp extends CCComp {
|
||||
smc.hero_back_x=right_x
|
||||
// console.log("count_hero_pos",smc.hero_pos,smc.hero_front_x,smc.mon_front_x)
|
||||
}
|
||||
|
||||
mon_refresh(){
|
||||
let num =3
|
||||
let t_num= Missions[0].length
|
||||
let y_num= Missions[1].length
|
||||
let b_num= Missions[2].length
|
||||
let tc=1
|
||||
let yc=2
|
||||
let bc=1
|
||||
for(let i=0;i<tc;i++){
|
||||
let x=RandomManager.instance.getRandomInt(0,t_num,1)
|
||||
this.addMonster(Missions[0][x],i)
|
||||
console.log("Missions t:"+x,Missions[0][x])
|
||||
}
|
||||
for(let i=0;i<yc;i++){
|
||||
let x=RandomManager.instance.getRandomInt(0,y_num,1)
|
||||
this.addMonster(Missions[1][x],i)
|
||||
console.log("Missions y:"+x,Missions[1][x])
|
||||
}
|
||||
for(let i=0;i<bc;i++){
|
||||
let x=RandomManager.instance.getRandomInt(0,b_num,1)
|
||||
console.log("Missions b:"+x,Missions[2][x])
|
||||
x=RandomManager.instance.getRandomInt(0,b_num,1)
|
||||
console.log("Missions b:"+x,Missions[2][x])
|
||||
x=RandomManager.instance.getRandomInt(0,b_num,1)
|
||||
console.log("Missions b:"+x,Missions[2][x])
|
||||
x=RandomManager.instance.getRandomInt(0,b_num,1)
|
||||
console.log("Missions b:"+x,Missions[2][x])
|
||||
x=RandomManager.instance.getRandomInt(0,b_num,1)
|
||||
console.log("Missions b:"+x,Missions[2][x])
|
||||
x=RandomManager.instance.getRandomInt(0,b_num,1)
|
||||
console.log("Missions b:"+x,Missions[2][x])
|
||||
this.addMonster(Missions[2][x],i,true)
|
||||
}
|
||||
}
|
||||
heros_call(){
|
||||
let heros=smc.fight_heros
|
||||
console.log("heros_call",heros)
|
||||
for(let i=0;i<heros.length;i++){
|
||||
this.addHero(heros[i],i)
|
||||
}
|
||||
this.hcard_call()
|
||||
}
|
||||
hcard_call(){
|
||||
let node =this.node.getChildByName("hcards")
|
||||
let heros:any= this.get_heros();
|
||||
|
||||
for(let i=0;i<heros.length;i++){
|
||||
let hcard = ecs.getEntity<HCard>(HCard)
|
||||
// console.log("hcard:",hcard)
|
||||
hcard.load(heros[i].HeroView.hero_uuid,i,node)
|
||||
}
|
||||
this.fight_start= true
|
||||
}
|
||||
/** 添加玩家 */
|
||||
private addHero(uuid:number=1001,i:number=0) {
|
||||
let hero = ecs.getEntity<Hero>(Hero);
|
||||
let scale = 1
|
||||
let pos:Vec3 = v3(HeroSet.StartPos[1]-i*10,BoxSet.GAME_LINE);
|
||||
hero.load(pos,scale,uuid);
|
||||
}
|
||||
private addMonster(uuid:number=1001,i:number=0,is_boss:boolean=false) {
|
||||
let mon = ecs.getEntity<Monster>(Monster);
|
||||
let scale = -1
|
||||
let pos:Vec3 = v3(-1*HeroSet.StartPos[1]+i*10,BoxSet.GAME_LINE);
|
||||
mon.load(pos,scale,uuid,is_boss);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/** 视图层逻辑代码分离演示 */
|
||||
|
||||
Reference in New Issue
Block a user