死亡计数出错修复 + 刷怪5个后间隔5秒
This commit is contained in:
@@ -104,7 +104,7 @@ export class MissionComp extends CCComp {
|
||||
smc.vmdata.mission_data.mon_num--
|
||||
if(smc.vmdata.mission_data.mon_num<=0 && this.count_tal() < 6) {
|
||||
if(smc.vmdata.mission_data.current_wave == RogueTalWave[this.count_tal()].wave){
|
||||
console.log("[MissionComp] 怪物全死亡后触发天赋奖励",RogueTalWave[this.count_tal()].tal_slot_key)
|
||||
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
|
||||
|
||||
|
||||
@@ -32,6 +32,9 @@ export class MissionMonCompComp extends CCComp { // 添加刷怪队列 - 扩
|
||||
private isSpawning: boolean = false;// 是否正在生成怪物
|
||||
private spawnInterval: number = 0.1; // 每个怪物生成间隔时间
|
||||
private spawnTimer: number = 0; // 生成计时器
|
||||
private spawnCount: number = 0; // 召唤计数器
|
||||
private pauseInterval: number = 5.0; // 暂停间隔时间(5秒)
|
||||
private isPausing: boolean = false; // 是否正在暂停
|
||||
|
||||
|
||||
onLoad(){
|
||||
@@ -46,12 +49,34 @@ export class MissionMonCompComp extends CCComp { // 添加刷怪队列 - 扩
|
||||
|
||||
protected update(dt: number): void {
|
||||
if(!smc.mission.play||smc.mission.pause) return
|
||||
|
||||
// 处理刷怪队列
|
||||
if (this.monsterQueue.length > 0 && !this.isSpawning) {
|
||||
this.spawnTimer += dt;
|
||||
|
||||
// 检查是否需要暂停(每召唤5次后暂停5秒)
|
||||
if (this.isPausing) {
|
||||
if (this.spawnTimer >= this.pauseInterval) {
|
||||
// 暂停结束,重置状态
|
||||
this.isPausing = false;
|
||||
this.spawnCount = 0;
|
||||
this.spawnTimer = 0;
|
||||
console.log("[MissionMonComp]: 暂停结束,继续召唤怪物");
|
||||
}
|
||||
return; // 暂停期间不召唤怪物
|
||||
}
|
||||
|
||||
// 正常召唤间隔
|
||||
if (this.spawnTimer >= this.spawnInterval) {
|
||||
this.spawnNextMonster();
|
||||
this.spawnTimer = 0;
|
||||
|
||||
// 检查是否需要进入暂停状态
|
||||
if (this.spawnCount >= 5) {
|
||||
this.isPausing = true;
|
||||
this.spawnTimer = 0; // 重置计时器用于暂停计时
|
||||
console.log("[MissionMonComp]: 已召唤5只怪物,开始暂停5秒");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -59,6 +84,11 @@ export class MissionMonCompComp extends CCComp { // 添加刷怪队列 - 扩
|
||||
|
||||
do_mon_wave(){
|
||||
console.log("[MissionMonComp]:怪物登场,当前波次 :",smc.vmdata.mission_data.current_wave)
|
||||
// 重置召唤相关状态
|
||||
this.spawnCount = 0;
|
||||
this.isPausing = false;
|
||||
this.spawnTimer = 0;
|
||||
|
||||
const currentWave = smc.vmdata.mission_data.current_wave;
|
||||
// 使用肉鸽模式配置
|
||||
const rogueWaveConfig = getRogueWaveConfig(currentWave);
|
||||
@@ -86,10 +116,11 @@ export class MissionMonCompComp extends CCComp { // 添加刷怪队列 - 扩
|
||||
|
||||
// 为每个怪物组生成指定数量的怪物
|
||||
for (let i = 0; i < count; i++) {
|
||||
// 随机选择位置 (0-9)
|
||||
// 位置循环使用 (0-9),如果怪物数量超过10个位置,则循环使用
|
||||
const position = i % 5;
|
||||
this.addToSpawnQueueWithAffixes(
|
||||
uuid,
|
||||
i,
|
||||
position,
|
||||
isBoss || false,
|
||||
monsterLevel,
|
||||
affixes,
|
||||
@@ -167,6 +198,10 @@ export class MissionMonCompComp extends CCComp { // 添加刷怪队列 - 扩
|
||||
monsterData.rogueHp,
|
||||
monsterData.rogueAttack
|
||||
);
|
||||
|
||||
// 增加召唤计数
|
||||
this.spawnCount++;
|
||||
console.log(`[MissionMonComp]: 召唤第${this.spawnCount}只怪物,剩余队列: ${this.monsterQueue.length}`);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user