死亡计数出错修复 + 刷怪5个后间隔5秒
This commit is contained in:
@@ -1342,7 +1342,7 @@
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 80,
|
||||
"height": 80
|
||||
"height": 100
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
|
||||
@@ -1342,7 +1342,7 @@
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 80,
|
||||
"height": 80
|
||||
"height": 120
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
|
||||
@@ -1342,7 +1342,7 @@
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 80,
|
||||
"height": 80
|
||||
"height": 100
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
|
||||
@@ -42,7 +42,7 @@ export class BuffComp extends Component {
|
||||
info_init(){
|
||||
this.HeroView=this.node.getComponent(HeroViewComp)
|
||||
this.top_node = this.node.getChildByName("top");
|
||||
let hp_y=this.node.getComponent(UITransform).height+20
|
||||
let hp_y=this.node.getComponent(UITransform).height
|
||||
this.top_node.setPosition(0,hp_y,0)
|
||||
this.hp_bar=this.top_node.getChildByName("hp").getComponent(ProgressBar)
|
||||
// this.top_node.getChildByName("hp").active=(this.node.getComponent(HeroViewComp).fac == 1 ? true : false)
|
||||
@@ -228,7 +228,7 @@ export class BuffComp extends Component {
|
||||
hp_tip(type:number=1,value:string="",s_uuid:number=1001,y:number=90){
|
||||
let tip =ecs.getEntity<Tooltip>(Tooltip);
|
||||
let x=this.node.position.x;
|
||||
let ny=this.node.getComponent(UITransform).height-20;
|
||||
let ny=this.node.getComponent(UITransform).height+20;
|
||||
let pos = v3(x,ny,0);
|
||||
tip.load(pos,type,value,s_uuid,this.node.parent);
|
||||
}
|
||||
|
||||
@@ -39,6 +39,7 @@ export class HeroViewComp extends CCComp {
|
||||
box_group:number = BoxSet.HERO;
|
||||
|
||||
is_dead:boolean = false; //是否摧毁
|
||||
is_count_dead:boolean = false; //是否计数死亡
|
||||
is_stop:boolean = false;
|
||||
is_atking:boolean = false;
|
||||
|
||||
@@ -446,7 +447,12 @@ export class HeroViewComp extends CCComp {
|
||||
//console.log("[HeroViewComp]:角色死亡",this.hero_uuid)
|
||||
|
||||
if(this.fac==FacSet.MON){
|
||||
if(this.is_count_dead) return
|
||||
this.is_count_dead=true
|
||||
this.scheduleOnce(()=>{
|
||||
oops.message.dispatchEvent(GameEvent.MonDead)
|
||||
},0.1)
|
||||
|
||||
}
|
||||
|
||||
if(this.fac==FacSet.HERO){
|
||||
|
||||
@@ -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