装备加成错误解决

This commit is contained in:
2025-06-13 15:10:47 +08:00
parent 3ec7c18ace
commit 008cd2ffc5
7 changed files with 107 additions and 81 deletions

View File

@@ -4,7 +4,7 @@ import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/modu
import { Monster } from "../hero/Mon";
import { BoxSet } from "../common/config/BoxSet";
import { HeroSet, MonSet } from "../common/config/heroSet";
import { Missions } from "../common/config/Mission";
import { FightSet, Missions } from "../common/config/Mission";
import { RandomManager } from "db://oops-framework/core/common/random/RandomManager";
import { Timer } from "db://oops-framework/core/common/timer/Timer";
import { smc } from "../common/SingletonModuleComp";
@@ -23,8 +23,9 @@ export class MissionMonCompComp extends CCComp {
private isSpawning: boolean = false;// 是否正在生成怪物
private spawnInterval: number = 1; // 每个怪物生成间隔时间
private spawnTimer: number = 0; // 生成计时器
private is_fight:boolean = false;
onLoad(){
this.on(GameEvent.FightStart,this.mon_refresh,this)
this.on(GameEvent.FightStart,this.to_fight,this)
}
/** 视图层逻辑代码分离演示 */
start() {
@@ -34,10 +35,12 @@ export class MissionMonCompComp extends CCComp {
}
protected update(dt: number): void {
if(!smc.mission.play||smc.mission.pause) return
// if(this.timer.update(dt)){
// this.mon_refresh()
// }
if(this.is_fight) {
if(this.timer.update(dt)){
this.do_mon_wave()
}
}
// 处理刷怪队列
if (this.monsterQueue.length > 0 && !this.isSpawning) {
this.spawnTimer += dt;
@@ -47,14 +50,20 @@ export class MissionMonCompComp extends CCComp {
}
}
}
to_fight(){
console.log("[MissionMonComp]:to_fight")
this.is_fight=true
this.do_mon_wave()
this.timer=new Timer(FightSet.MON_WAVE_TIME)
}
test_call(){
this.addToSpawnQueue(5202, 0, true);
}
mon_refresh(){
do_mon_wave(){
oops.message.dispatchEvent(GameEvent.WaveUpdate)
console.log("怪物登场,当前波次 :",smc.vmdata.mission_data.current_wave)
console.log("[MissionMonComp]:怪物登场,当前波次 :",smc.vmdata.mission_data.current_wave)
let positions = [0, 1, 2];
positions.forEach(pos => {
let x = RandomManager.instance.getRandomInt(0, Missions[0].length, 1);
@@ -62,6 +71,7 @@ export class MissionMonCompComp extends CCComp {
});
}
// 新增:添加到刷怪队列
private addToSpawnQueue(uuid: number, position: number, isBoss: boolean = false) {
this.monsterQueue.push({