ECS improved to make it less annoying to use
AddComponent<Components::Transform>(entity, "Transform") is now AddComponent<Components::Transform>(entity) etc.
This commit is contained in:
+1
-11
@@ -132,11 +132,6 @@ void World::Initialize()
|
||||
}
|
||||
}
|
||||
|
||||
std::shared_ptr<Component> World::AddComponent(EntityID entity, std::string componentType)
|
||||
{
|
||||
return AddComponent<Component>(entity, componentType);
|
||||
}
|
||||
|
||||
void World::CommitEntity(EntityID entity)
|
||||
{
|
||||
for (auto pair : m_Systems)
|
||||
@@ -158,11 +153,6 @@ void World::AddComponent(EntityID entity, std::string componentType, std::shared
|
||||
}
|
||||
}
|
||||
|
||||
void World::AddSystem(std::string systemType)
|
||||
{
|
||||
m_Systems[systemType] = std::shared_ptr<System>(m_SystemFactory.Create(systemType));
|
||||
}
|
||||
|
||||
EntityID World::CloneEntity(EntityID entity, EntityID parent /* = 0 */)
|
||||
{
|
||||
int clone = CreateEntity(parent);
|
||||
@@ -170,7 +160,7 @@ EntityID World::CloneEntity(EntityID entity, EntityID parent /* = 0 */)
|
||||
for (auto pair : m_EntityComponents[entity])
|
||||
{
|
||||
auto type = pair.first;
|
||||
if (type == "Template")
|
||||
if (type == typeid(Components::Template).name())
|
||||
continue;
|
||||
auto component = std::shared_ptr<Component>(pair.second->Clone());
|
||||
if (component != nullptr)
|
||||
|
||||
Reference in New Issue
Block a user