feat(关卡): 将Boss刷新机制改为基于时间轴
将Boss刷新从固定周期改为基于时间轴配置,支持在特定时间点生成多个Boss
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -7,7 +7,7 @@ import { HeroInfo, MonStart } from "../common/config/heroSet";
|
|||||||
import { smc } from "../common/SingletonModuleComp";
|
import { smc } from "../common/SingletonModuleComp";
|
||||||
import { GameEvent } from "../common/config/GameEvent";
|
import { GameEvent } from "../common/config/GameEvent";
|
||||||
import {BoxSet } from "../common/config/GameSet";
|
import {BoxSet } from "../common/config/GameSet";
|
||||||
import { BossList, BossSpawnCd, MonList, MonType, SpawnBaseCd, SpawnMinCd, SpawnPowerBias, SpawnStageReduce, StageBossGrow, StageDuration, StageGrow, UpType } from "./RogueConfig";
|
import { BossList, BossSpawnTimeline, MonList, MonType, SpawnBaseCd, SpawnMinCd, SpawnPowerBias, SpawnStageReduce, StageBossGrow, StageDuration, StageGrow, UpType } from "./RogueConfig";
|
||||||
import { HeroAttrsComp } from "../hero/HeroAttrsComp";
|
import { HeroAttrsComp } from "../hero/HeroAttrsComp";
|
||||||
import { MoveComp } from "../hero/MoveComp";
|
import { MoveComp } from "../hero/MoveComp";
|
||||||
const { ccclass, property } = _decorator;
|
const { ccclass, property } = _decorator;
|
||||||
@@ -36,8 +36,7 @@ export class MissionMonCompComp extends CCComp {
|
|||||||
private waveTimer: number = 0;
|
private waveTimer: number = 0;
|
||||||
/** 插队刷怪处理计时器 */
|
/** 插队刷怪处理计时器 */
|
||||||
private queueTimer: number = 0;
|
private queueTimer: number = 0;
|
||||||
/** Boss 刷新计时器 */
|
private nextBossSpawnIndex: number = 0;
|
||||||
private bossTimer: number = 0;
|
|
||||||
onLoad(){
|
onLoad(){
|
||||||
// 关卡准备、切换波次时重置刷怪状态
|
// 关卡准备、切换波次时重置刷怪状态
|
||||||
this.on(GameEvent.FightReady,this.fight_ready,this)
|
this.on(GameEvent.FightReady,this.fight_ready,this)
|
||||||
@@ -72,7 +71,7 @@ export class MissionMonCompComp extends CCComp {
|
|||||||
this.gameTime = 0
|
this.gameTime = 0
|
||||||
this.waveTimer = 0
|
this.waveTimer = 0
|
||||||
this.queueTimer = 0
|
this.queueTimer = 0
|
||||||
this.bossTimer = 0
|
this.nextBossSpawnIndex = 0
|
||||||
this.MonQueue = []
|
this.MonQueue = []
|
||||||
this.spawnCount = 0
|
this.spawnCount = 0
|
||||||
|
|
||||||
@@ -84,15 +83,14 @@ export class MissionMonCompComp extends CCComp {
|
|||||||
if(!smc.mission.play) return
|
if(!smc.mission.play) return
|
||||||
if(smc.mission.pause) return
|
if(smc.mission.pause) return
|
||||||
if(smc.mission.stop_mon_action) return;
|
if(smc.mission.stop_mon_action) return;
|
||||||
if(smc.mission.stop_spawn_mon) return;
|
|
||||||
if(!smc.mission.in_fight) return;
|
if(!smc.mission.in_fight) return;
|
||||||
|
|
||||||
// 计时推进:所有“按时间驱动”的曲线都依赖 gameTime
|
// 计时推进:所有“按时间驱动”的曲线都依赖 gameTime
|
||||||
this.gameTime += dt;
|
this.gameTime += dt;
|
||||||
// 刷怪优先级:特殊队列 > 普通怪 > Boss(都满足条件时同帧可连续执行)
|
this.updateBossSpawn();
|
||||||
|
if(smc.mission.stop_spawn_mon) return;
|
||||||
this.updateSpecialQueue(dt);
|
this.updateSpecialQueue(dt);
|
||||||
this.updateNormalSpawn(dt);
|
this.updateNormalSpawn(dt);
|
||||||
this.updateBossSpawn(dt);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -124,15 +122,17 @@ export class MissionMonCompComp extends CCComp {
|
|||||||
this.spawnCount += 1;
|
this.spawnCount += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
private updateBossSpawn(dt: number) {
|
private updateBossSpawn() {
|
||||||
this.bossTimer += dt;
|
while (
|
||||||
// Boss 按固定周期出现,不受普通怪 CD 影响
|
this.nextBossSpawnIndex < BossSpawnTimeline.length &&
|
||||||
if (this.bossTimer < BossSpawnCd) return;
|
this.gameTime >= BossSpawnTimeline[this.nextBossSpawnIndex]
|
||||||
this.bossTimer = 0;
|
) {
|
||||||
const uuid = this.getRandomBossUuid();
|
const uuid = this.getRandomBossUuid();
|
||||||
const upType = this.getRandomUpType();
|
const upType = this.getRandomUpType();
|
||||||
this.addMonster(uuid, this.spawnCount, true, upType);
|
this.addMonster(uuid, this.spawnCount, true, upType);
|
||||||
this.spawnCount += 1;
|
this.spawnCount += 1;
|
||||||
|
this.nextBossSpawnIndex += 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private getCurrentStage(): number {
|
private getCurrentStage(): number {
|
||||||
|
|||||||
@@ -33,6 +33,6 @@ export const StageDuration = 30
|
|||||||
export const SpawnBaseCd = 1.6
|
export const SpawnBaseCd = 1.6
|
||||||
export const SpawnMinCd = 0.5
|
export const SpawnMinCd = 0.5
|
||||||
export const SpawnStageReduce = 0.08
|
export const SpawnStageReduce = 0.08
|
||||||
export const BossSpawnCd = 90
|
export const BossSpawnTimeline = [60, 120, 180, 240, 300]
|
||||||
export const SpawnPowerBias = 1
|
export const SpawnPowerBias = 1
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user