diff --git a/assets/script/game/hero/HeroViewComp.ts b/assets/script/game/hero/HeroViewComp.ts index 5bae1f9f..1a2bff36 100644 --- a/assets/script/game/hero/HeroViewComp.ts +++ b/assets/script/game/hero/HeroViewComp.ts @@ -136,6 +136,9 @@ export class HeroViewComp extends CCComp { if(this.model.fac==FacSet.HERO){ hpNode.getChildByName("Bar").getComponent(Sprite).color=new Color("#2ECC71") } + + // 确保血条等UI始终在最上层显示 + this.top_node.setSiblingIndex(999); } @@ -311,8 +314,8 @@ export class HeroViewComp extends CCComp { halfHeight = transform.height / 2; } - // 起点设为怪物中心位置 + 20偏移 - let ny = this.node.position.y + halfHeight + 20; + // 起点设为怪物中心偏下位置,使其在血条下方 + let ny = this.node.position.y + halfHeight - 15; let pos = v3(x, ny, 0); Tooltip.load(pos, type, value, s_uuid, this.node.parent, 1, this.model?.fac ?? FacSet.MON); } @@ -480,9 +483,8 @@ export class HeroViewComp extends CCComp { // 死亡往后飞出屏幕动画 tween(this.node) - .by(0.5, { position: v3(dirX, 700, 0), angle: isHero ? 360 : -360 }, { easing: "quadOut" }) + .by(0.5, { position: v3(dirX, 700, 0) }, { easing: "quadOut" }) .call(() => { - this.node.angle = 0; // 重置角度 if (isHero) { // 将英雄移到玩家看不到的墓地,留待下回合上场 this.node.setPosition(v3(-2000, -2000, 0)); diff --git a/assets/script/game/hero/Mon.ts b/assets/script/game/hero/Mon.ts index 5c0c20c5..2cce6fbe 100644 --- a/assets/script/game/hero/Mon.ts +++ b/assets/script/game/hero/Mon.ts @@ -212,30 +212,43 @@ export class Monster extends ecs.Entity { // 依据下落距离自适应入场时长,确保观感一致 const dropDistance = Math.abs(pos.y - dropToY); - const dropDuration = Math.max(0.18, Math.min(0.38, dropDistance / 1200)); + + const onDropComplete = () => { + if (!node || !node.isValid) return; + // 落地后锁定最终位置,切换到落地完成状态 + node.setPosition(pos.x, dropToY, 0); + if (dropDistance > 0) { + view.playEnd("down"); + } else { + view.status_change("move"); // 直接进入移动状态 + } + + move.moving = true; + // 落地后启用怪物碰撞分组 + if (collider) { + collider.enabled = true; + collider.group = BoxSet.MONSTER; + collider.apply(); + } + + // 落地后触发 call 技能 + SkillTriggerHelper.trigger(SkillTriggerType.Call, model, view); + }; // 停止旧动画后执行下落 tween,避免复用节点时动画叠加 Tween.stopAllByTarget(node); - tween(node) - .to(dropDuration, { position: v3(pos.x, dropToY, 0) }) - .call(() => { - if (!node || !node.isValid) return; - // 落地后锁定最终位置,切换到落地完成状态 - node.setPosition(pos.x, dropToY, 0); - view.playEnd("down"); - - move.moving = true; - // 落地后启用怪物碰撞分组 - if (collider) { - collider.enabled = true; - collider.group = BoxSet.MONSTER; - collider.apply(); - } - - // 落地后触发 call 技能 - SkillTriggerHelper.trigger(SkillTriggerType.Call, model, view); - }) - .start(); + + if (dropDistance > 0) { + const dropDuration = Math.max(0.18, Math.min(0.38, dropDistance / 1200)); + tween(node) + .to(dropDuration, { position: v3(pos.x, dropToY, 0) }) + .call(onDropComplete) + .start(); + } else { + // 没有下落距离,直接出现在目标位置并开始移动 + node.setPosition(pos.x, dropToY, 0); + onDropComplete(); + } // 维护关卡内怪物数量统计 smc.vmdata.mission_data.mon_num++ } diff --git a/assets/script/game/map/MissionMonComp.ts b/assets/script/game/map/MissionMonComp.ts index 0a123095..2b5816ea 100644 --- a/assets/script/game/map/MissionMonComp.ts +++ b/assets/script/game/map/MissionMonComp.ts @@ -52,11 +52,11 @@ export class MissionMonCompComp extends CCComp { // ======================== 常量 ======================== /** 怪物出生点起点 X */ - private static readonly MON_SPAWN_START_X = 280; + private static readonly MON_SPAWN_START_X = 460; /** 怪物出生的 X 间距 */ private static readonly MON_SPAWN_GAP_X = 50; /** 怪物出生掉落高度 */ - private static readonly MON_DROP_HEIGHT = 280; + private static readonly MON_DROP_HEIGHT = 0; /** 6路高度偏移(在三路的y轴范围内,实现 6路 进军) */ private static readonly LANE_Y_OFFSETS = [100, 60, 20, -20, -60, -100];