feat(怪物): 添加怪物y轴移动逻辑和死亡时间优化

为怪物添加y轴移动能力,使其能够向目标y坐标移动。同时优化怪物死亡时间,使用单独的monDeadTime变量控制怪物死亡时间,区别于英雄的realDeadTime。主要修改包括:
1. 在MonMoveComp中添加targetY字段用于y轴移动目标
2. 实现y轴移动逻辑和位置检查
3. 为HeroViewComp添加monDeadTime字段并应用
This commit is contained in:
walkpan
2026-01-02 14:53:44 +08:00
parent 91129505d2
commit f3039eb47b
2 changed files with 69 additions and 9 deletions

View File

@@ -47,6 +47,7 @@ export class HeroViewComp extends CCComp {
box_group:number = BoxSet.HERO; // 碰撞组
realDeadTime:number=10
deadCD:number=0
monDeadTime:number=0.5
// 血条显示相关
hpBarShowTime:number = 5; // 血条显示持续时间(秒)
hpBarShowCD:number = 0; // 血条显示计时器
@@ -357,6 +358,12 @@ export class HeroViewComp extends CCComp {
if(this.model.is_count_dead) return;
this.model.is_count_dead = true; // 防止重复触发,必须存在防止重复调用
this.top_node.active=false
// 怪物使用0.5秒死亡时间英雄使用realDeadTime
if(this.model.fac === FacSet.MON){
this.realDeadTime = this.monDeadTime;
}
// 播放死亡特效
this.as.dead();