68 [[nodiscard]]
bool has_prefab(
const std::string& prefab_type_id)
const;
79 const std::string& prefab_type_id,
Scene& scene,
const std::string& name);
92 std::map<std::string, PrefabFactory> prefab_factories_;
Concept to constrain types to be derived from Component.
Definition gameObject.h:33
Definition iEngineService.h:4
Global service for managing prefab factories and component creation.
Definition prefab_service.h:40
void clear_all()
Clear all registered prefabs.
PrefabService & operator=(const PrefabService &)=delete
PrefabService(const PrefabService &)=delete
void register_prefab(const std::string &prefab_type_id, const PrefabFactory &factory)
Register a prefab factory for a given type ID.
PrefabService(PrefabService &&)=delete
void unregister_prefab(const std::string &prefab_type_id)
Unregister a previously registered prefab factory.
std::vector< std::string > get_registered_prefabs() const
Get all registered prefab type IDs.
PrefabService & operator=(PrefabService &&)=delete
bool has_prefab(const std::string &prefab_type_id) const
Check if a prefab type is registered.
std::reference_wrapper< GameObject > instantiate(const std::string &prefab_type_id, Scene &scene, const std::string &name)
Instantiate a GameObject from a registered prefab.
Represents a scene within the engine. A scene contains multiple GameObjects and manages their lifecyc...
Definition scene.h:19
std::function< GameObject &(Scene &, const std::string &)> PrefabFactory
A prefab factory function that creates a GameObject with predefined components.
Definition prefab_service.h:20