战斗管理系统基础

This commit is contained in:
2025-02-03 22:02:26 +08:00
parent 060046a6a6
commit 36a8aff783
27 changed files with 375 additions and 619 deletions

View File

@@ -21,7 +21,7 @@ import { UIID } from "../common/config/GameUIConfig";
import { CardControllerComp } from "./CardController";
import { MissionHomeComp } from "./MissionHomeComp";
import { GameEvent } from "../common/config/GameEvent";
import { BattleState } from "../battle/BattleStateComp";
import { BattleManager } from "../battle/BattleManager";
const { ccclass, property } = _decorator;
/** 视图层对象 */
@@ -69,42 +69,30 @@ export class MissionComp extends CCComp {
// }
// this.shuaxin(dt)
}
mission_start(){
/* todo 关卡设定完善*/
console.log("mission_start Missions mons:",Missions[smc.mission.lv])
this.colose_victory()
this.mission_init()
// this.mskill_init()
this.mon_refresh()
this.heros_call()
mission_start(missionId: number) {
// 初始化关卡数据
this.colose_victory();
this.mission_init();
// 启动战斗(外部控制入口)
BattleManager.startBattle(smc.mission.lv);
// 生成怪物和英雄
this.mon_refresh();
this.heros_call();
}
mission_end(){
oops.message.dispatchEvent(GameEvent.MissionEnd)
smc.mission.play=false
smc.mission.pause=false
let heros:any= this.get_heros();;
let monsters:any= this.get_mons();
let hcards:any= ecs.query(ecs.allOf(HCardComp));
let rewards:any= ecs.query(ecs.allOf(ItemComp));
// let hcns=this.node.getChildByName("hcards")
// for(let i=0;i<hcns.children.length;i++){
// hcns.children[i].destroy()
// }
for(let i=0;i<heros.length;i++){
heros[i].HeroView.reset()
heros[i].HeroView.ent.destroy()
}
for(let i=0;i<hcards.length;i++){
hcards[i].HCardComp.reset()
hcards[i].HCardComp.ent.destroy()
}
for(let i=0;i<monsters.length;i++){
monsters[i].HeroView.reset()
monsters[i].HeroView.ent.destroy()
}
// this.to_mission_home()
this.open_victory()
mission_end() {
// 结束战斗(外部控制出口)
BattleManager.endBattle();
// 更新游戏状态
oops.message.dispatchEvent(GameEvent.MissionEnd);
smc.mission.play = false;
// 显示结算界面
this.open_victory();
}
open_victory(){