return build(environment, networkSystem, reflectFactory, new CopyStrategyLibrary(reflectFactory));
}
public EngineEntityManager build(ModuleEnvironment environment, NetworkSystem networkSystem, ReflectFactory reflectFactory, CopyStrategyLibrary copyStrategyLibrary) {
// Entity Manager
PojoEntityManager entityManager = CoreRegistry.put(EntityManager.class, new PojoEntityManager());
CoreRegistry.put(EngineEntityManager.class, entityManager);
// Standard serialization library
TypeSerializationLibrary typeSerializationLibrary = buildTypeLibrary(entityManager, reflectFactory, copyStrategyLibrary);
entityManager.setTypeSerializerLibrary(typeSerializationLibrary);
// Entity System Library
EntitySystemLibrary library = CoreRegistry.put(EntitySystemLibrary.class, new EntitySystemLibrary(reflectFactory, copyStrategyLibrary, typeSerializationLibrary));
entityManager.setEntitySystemLibrary(library);
CoreRegistry.put(ComponentLibrary.class, library.getComponentLibrary());
CoreRegistry.put(EventLibrary.class, library.getEventLibrary());
// Prefab Manager
PrefabManager prefabManager = new PojoPrefabManager();
entityManager.setPrefabManager(prefabManager);
CoreRegistry.put(PrefabManager.class, prefabManager);
// Event System
EventSystem eventSystem = new EventSystemImpl(library.getEventLibrary(), networkSystem);
entityManager.setEventSystem(eventSystem);
CoreRegistry.put(EventSystem.class, eventSystem);
// TODO: Review - NodeClassLibrary related to the UI for behaviours. Should not be here and probably not even in the CoreRegistry
CoreRegistry.put(OneOfProviderFactory.class, new OneOfProviderFactory());
// Behaviour Trees Node Library
NodesClassLibrary nodesClassLibrary = new NodesClassLibrary(reflectFactory, copyStrategyLibrary);
CoreRegistry.put(NodesClassLibrary.class, nodesClassLibrary);
nodesClassLibrary.scan(environment);
registerComponents(library.getComponentLibrary(), environment);
registerEvents(entityManager.getEventSystem(), environment);
return entityManager;
}