export class EntityFactory { static createHero(config: HeroConfig): ecs.Entity { const hero = ecs.Entity.create(); // 基础组件 hero.add(HeroModel).init(config); hero.add(HeroView).loadModel(config.prefabPath); hero.add(Movement).init(config.speed); hero.add(Combat).init(config.baseAttack, config.attackRange); // 技能系统 config.skills.forEach(skill => { hero.add(Skill).registerSkill(skill); }); return hero; } }