英雄和敌人 全死亡后,判定解决
This commit is contained in:
@@ -78,21 +78,7 @@ export class EquipSkillComp extends CCComp {
|
||||
}
|
||||
update(dt: number): void {
|
||||
if(!smc.mission.play||smc.mission.pause) return
|
||||
if(this.skill1.uuid!=0){
|
||||
let cd=this.skill1.cd/((smc.vmdata.hero.skill_cd_buff)/100+1)
|
||||
if(this.skill1.cd_time < cd){
|
||||
this.skill1.cd_time+=dt
|
||||
}else{
|
||||
if(this.skill1.type==1){
|
||||
this.do_skill1()
|
||||
}
|
||||
}
|
||||
this.skill1_cd_bar_progress.progress=(1-this.skill1.cd_time/cd)
|
||||
}
|
||||
if(this.skill2.uuid!=0&&smc.vmdata.hero.power>=smc.vmdata.hero.power_max&&!this.max_show){
|
||||
this.show_max()
|
||||
this.max_show=true
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
show_max(){
|
||||
@@ -116,13 +102,10 @@ export class EquipSkillComp extends CCComp {
|
||||
}
|
||||
|
||||
do_skill2(){
|
||||
if(smc.vmdata.hero.power<smc.vmdata.hero.power_max) return
|
||||
console.log("do_skill2")
|
||||
tween(this.boxs.getChildByName("skill2")).to(0.1, {scale:v3(1.5,1.5,1)},{onComplete:()=>{
|
||||
tween(this.boxs.getChildByName("skill2")).to(0.2, {scale:v3(1,1,1)}).start()
|
||||
}}).start()
|
||||
this.do_skill(this.skill2.uuid)
|
||||
smc.vmdata.hero.power=0
|
||||
this.hide_max()
|
||||
}
|
||||
|
||||
|
||||
@@ -57,18 +57,6 @@ export class MSkillComp extends CCComp {
|
||||
}
|
||||
update(dt: number): void {
|
||||
if(!smc.mission.play||smc.mission.pause) return
|
||||
if(this.skill.uuid!=0){
|
||||
let cd=this.skill.cd/((smc.vmdata.hero.skill_cd_buff)/100+1)
|
||||
if(this.skill.cd_time < cd){
|
||||
this.skill.cd_time+=dt
|
||||
}else{
|
||||
if(this.skill.type==1){
|
||||
this.spell_skill()
|
||||
}
|
||||
}
|
||||
let progress=(1-this.skill.cd_time/cd)
|
||||
this.node.getChildByName("icon").getChildByName("cd").getComponent(ProgressBar).progress=progress
|
||||
}
|
||||
|
||||
}
|
||||
show_max(){
|
||||
|
||||
@@ -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()});
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -46,6 +46,7 @@ export class MissionHeroCompComp extends CCComp {
|
||||
// }
|
||||
// this.current_hero_num=-1
|
||||
// this.current_hero_uuid=0
|
||||
smc.vmdata.mission_data.hero_num=0
|
||||
console.log("[MissionHeroComp]:fight_ready",smc.fight_heros,Object.keys(smc.fight_heros).length)
|
||||
let heros:any = smc.fight_heros
|
||||
for(let i=0;i<Object.keys(heros).length;i++){
|
||||
|
||||
@@ -55,6 +55,7 @@ export class MissionMonCompComp extends CCComp { // 添加刷怪队列 - 使
|
||||
|
||||
fight_ready(){
|
||||
// console.log("[MissionMonComp]:fight_ready")
|
||||
smc.vmdata.mission_data.mon_num=0
|
||||
this.do_mon_wave()
|
||||
}
|
||||
|
||||
@@ -95,7 +96,6 @@ export class MissionMonCompComp extends CCComp { // 添加刷怪队列 - 使
|
||||
|
||||
|
||||
do_mon_wave(){
|
||||
// console.log("[MissionMonComp]:怪物登场,当前关卡 :",smc.vmdata.mission_data.current_wave)
|
||||
// 重置召唤相关状态
|
||||
this.spawnCount = 0;
|
||||
this.isPausing = false;
|
||||
@@ -112,11 +112,10 @@ export class MissionMonCompComp extends CCComp { // 添加刷怪队列 - 使
|
||||
|
||||
// 根据新的关卡配置生成怪物
|
||||
private generateMonstersFromStageConfig(monsterConfigs: any[]) {
|
||||
const currentStage = smc.vmdata.mission_data.current_wave;
|
||||
const currentStage = smc.vmdata.mission_data.mission;
|
||||
|
||||
// 设置怪物总数
|
||||
smc.vmdata.mission_data.mon_num = monsterConfigs.length;
|
||||
|
||||
console.log("[MissionMonComp] generateMonstersFromStageConfig",monsterConfigs)
|
||||
if (!monsterConfigs || monsterConfigs.length === 0) {
|
||||
console.warn(`[MissionMonComp]:关卡${currentStage}配置中没有怪物信息`);
|
||||
return;
|
||||
|
||||
@@ -26,7 +26,7 @@ export class VictoryComp extends CCComp {
|
||||
this.hide()
|
||||
}
|
||||
fight_end(e:any,val:any){
|
||||
|
||||
console.log("[VictoryComp] fight_end",val)
|
||||
this.open()
|
||||
}
|
||||
victory_end(){
|
||||
|
||||
Reference in New Issue
Block a user