Prefab saving

This commit is contained in:
antopilo
2021-08-26 20:46:34 -04:00
parent 96f0cdb4e9
commit 3fb0a2cc81
6 changed files with 117 additions and 9 deletions

View File

@@ -0,0 +1,24 @@
#include "Prefab.h"
#include "src/Scene/Components/ParentComponent.h"
namespace Nuake {
Ref<Prefab> Prefab::CreatePrefabFromEntity(Entity entity)
{
Ref<Prefab> prefab = CreateRef<Prefab>();
ParentComponent parentC = entity.GetComponent<ParentComponent>();
prefab->EntityWalker(entity);
return prefab;
}
void Prefab::EntityWalker(Entity entity)
{
entity.GetComponent<NameComponent>().IsPrefab = true;
Entities.push_back(entity);
for (const Entity& e : entity.GetComponent<ParentComponent>().Children)
{
EntityWalker(e);
}
}
}