This commit is contained in:
walkpan
2025-02-01 00:14:25 +08:00
parent c5c01c6cf4
commit bffbb9077e
91 changed files with 2067 additions and 1327 deletions

View File

@@ -0,0 +1,18 @@
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;
}
}