feat: 为英雄和怪物添加下落入场动画

- 在 MissionHeroComp 和 MissionMonComp 中定义下落高度常量
- 修改英雄和怪物的加载方法,接受目标落地高度参数
- 使用 Tween 实现平滑下落动画,下落距离越大持续时间越长
- 下落期间禁用移动和碰撞器,落地后恢复
- 为怪物添加随机下落高度偏移,减轻重叠感
This commit is contained in:
panw
2026-03-19 09:11:11 +08:00
parent a20e5db00b
commit 1522e93585
4 changed files with 51 additions and 20 deletions

View File

@@ -13,6 +13,7 @@ const { ccclass, property } = _decorator;
@ccclass('MissionHeroCompComp')
@ecs.register('MissionHeroComp', false)
export class MissionHeroCompComp extends CCComp {
private static readonly HERO_DROP_HEIGHT = 260
timer:Timer=new Timer(2)
Friend_is_dead:boolean=false
current_hero_uuid:number=0
@@ -59,8 +60,9 @@ export class MissionHeroCompComp extends CCComp {
let hero_pos=0
let hero = ecs.getEntity<Hero>(Hero);
let scale = 1
let pos:Vec3 = HeroPos[hero_pos].pos;
hero.load(pos,scale,uuid);
let landingPos:Vec3 = HeroPos[hero_pos].pos;
let spawnPos:Vec3 = v3(landingPos.x, landingPos.y + MissionHeroCompComp.HERO_DROP_HEIGHT, 0);
hero.load(spawnPos,scale,uuid,landingPos.y);
}
@@ -70,4 +72,4 @@ export class MissionHeroCompComp extends CCComp {
reset() {
// this.node.destroy();
}
}
}