refactor(mission): 移除英雄二合一合成逻辑,改为允许同英雄同场
1. 删除Hero类中的mergeToBirthAndDestroy方法 2. 移除MissionHeroComp中的合成相关校验与处理逻辑 3. 简化英雄召唤流程,不再限制同uuid英雄重复召唤 4. 更新注释文档,调整相关导入依赖
This commit is contained in:
@@ -268,36 +268,6 @@ export class Hero extends ecs.Entity {
|
||||
.start();
|
||||
}
|
||||
|
||||
mergeToBirthAndDestroy(birthPos: Vec3, onDone?: () => void) {
|
||||
const view = this.get(HeroViewComp);
|
||||
const node = view?.node;
|
||||
if (!node || !node.isValid) {
|
||||
this.destroy();
|
||||
if (onDone) onDone();
|
||||
return;
|
||||
}
|
||||
const collider = node.getComponent(BoxCollider2D);
|
||||
if (collider) {
|
||||
collider.enabled = false;
|
||||
}
|
||||
const body = node.getComponent(RigidBody2D);
|
||||
if (body) {
|
||||
body.enabled = false;
|
||||
}
|
||||
const currentPos = node.getPosition();
|
||||
const targetPos = v3(birthPos.x, birthPos.y, 0);
|
||||
const moveDistance = Vec3.distance(currentPos, targetPos);
|
||||
const moveDuration = Math.max(0.12, Math.min(0.3, moveDistance / 1200));
|
||||
Tween.stopAllByTarget(node);
|
||||
tween(node)
|
||||
.to(moveDuration, { position: targetPos })
|
||||
.call(() => {
|
||||
this.destroy();
|
||||
if (onDone) onDone();
|
||||
})
|
||||
.start();
|
||||
}
|
||||
|
||||
/** 重置入口:复用 destroy 的释放流程 */
|
||||
reset() {
|
||||
super.destroy();
|
||||
|
||||
Reference in New Issue
Block a user