英雄和敌人 全死亡后,判定解决
This commit is contained in:
@@ -3,10 +3,12 @@ import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ec
|
||||
import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
|
||||
import { smc } from "../common/SingletonModuleComp";
|
||||
import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
|
||||
import { FightSet, HeroUI, MissionData, VmInfo} from "../common/config/Mission";
|
||||
import { FightSet} from "../common/config/Mission";
|
||||
import { Timer } from "../../../../extensions/oops-plugin-framework/assets/core/common/timer/Timer";
|
||||
import { GameEvent } from "../common/config/GameEvent";
|
||||
import { HeroViewComp } from "../hero/HeroViewComp";
|
||||
import { MonModelComp } from "../hero/MonModelComp";
|
||||
import { SkillCom } from "../skills/SkillCom";
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
|
||||
@@ -24,7 +26,7 @@ export class MissionComp extends CCComp {
|
||||
onLoad(){
|
||||
this.on(GameEvent.MissionStart,this.mission_start,this)
|
||||
this.on(GameEvent.MonDead,this.do_mon_dead,this)
|
||||
|
||||
this.on(GameEvent.HeroDead,this.do_hero_dead,this)
|
||||
this.on(GameEvent.FightEnd,this.fight_end,this)
|
||||
this.on(GameEvent.MissionEnd,this.mission_end,this)
|
||||
this.on(GameEvent.DO_AD_BACK,this.do_ad,this)
|
||||
@@ -44,22 +46,21 @@ export class MissionComp extends CCComp {
|
||||
}
|
||||
|
||||
do_mon_dead(){
|
||||
this.do_mon_dead_thing()
|
||||
smc.addGold(1)
|
||||
smc.vmdata.mission_data.mon_num--
|
||||
console.log("[MissionComp] do_mon_dead",smc.vmdata.mission_data.mon_num)
|
||||
if(smc.vmdata.mission_data.mon_num<=0) {
|
||||
// if(smc.vmdata.mission_data.current_wave == RogueTalWave[this.count_tal()].wave){
|
||||
// console.log("[MissionComp] current_wave:"+smc.vmdata.mission_data.current_wave+" tal wave:"+RogueTalWave[this.count_tal()].wave)
|
||||
// oops.message.dispatchEvent(GameEvent.TalentSelect,{slot:TalentSlot[this.count_tal()]})
|
||||
// this.tals[this.count_tal()]=true
|
||||
|
||||
// }
|
||||
smc.setGameProperty("mission",smc.data.mission+1,true)
|
||||
oops.message.dispatchEvent(GameEvent.FightEnd,{victory:true})
|
||||
}
|
||||
}
|
||||
|
||||
do_mon_dead_thing(){
|
||||
smc.addGold(1)
|
||||
do_hero_dead(){
|
||||
smc.vmdata.mission_data.hero_num--
|
||||
console.log("[MissionComp] do_hero_dead",smc.vmdata.mission_data.hero_num)
|
||||
if(smc.vmdata.mission_data.hero_num<=0) {
|
||||
oops.message.dispatchEvent(GameEvent.FightEnd,{victory:false})
|
||||
}
|
||||
}
|
||||
|
||||
do_ad(){
|
||||
if(this.ad_back()){
|
||||
oops.message.dispatchEvent(GameEvent.AD_BACK_TRUE)
|
||||
@@ -87,14 +88,14 @@ export class MissionComp extends CCComp {
|
||||
loading.active=true
|
||||
this.scheduleOnce(()=>{
|
||||
loading.active=false
|
||||
this.node.getChildByName("ending").active=false
|
||||
},1)
|
||||
this.to_fight()
|
||||
|
||||
},0.5)
|
||||
this.scheduleOnce(()=>{
|
||||
this.to_fight()
|
||||
},0.1)
|
||||
|
||||
}
|
||||
|
||||
to_fight(){
|
||||
console.log("[MissionComp] ** 3 ** to_fight")
|
||||
smc.mission.in_fight=true
|
||||
oops.message.dispatchEvent(GameEvent.FightStart) //MissionMonComp 监听刷怪
|
||||
}
|
||||
@@ -107,8 +108,6 @@ export class MissionComp extends CCComp {
|
||||
|
||||
fight_end(){
|
||||
console.log("任务结束")
|
||||
this.node.getChildByName("ending").active=true
|
||||
this.node.getChildByName("ending").getComponent(Animation).play("endFight")
|
||||
// 延迟0.5秒后执行任务结束逻辑
|
||||
this.scheduleOnce(() => {
|
||||
smc.mission.play=false
|
||||
@@ -125,12 +124,14 @@ export class MissionComp extends CCComp {
|
||||
data_init(){
|
||||
//局内数据初始化 smc 数据初始化
|
||||
smc.mission.play = true;
|
||||
smc.vmdata.mission_data = JSON.parse(JSON.stringify(MissionData));
|
||||
console.log("局内数据初始化")
|
||||
smc.vmdata.mission_data.in_fight=false
|
||||
smc.vmdata.mission_data.fight_time=0
|
||||
console.log("[MissionComp]局内数据初始化",smc.vmdata.mission_data)
|
||||
}
|
||||
|
||||
private cleanComponents() {
|
||||
ecs.query(ecs.allOf(HeroViewComp)).forEach(entity => {entity.remove(HeroViewComp);entity.destroy()});
|
||||
ecs.query(ecs.allOf(SkillCom)).forEach(entity => {entity.remove(SkillCom);entity.destroy()});
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user