|
|
|
|
/******************************************************************************
|
|
|
|
|
* File - entity.cpp
|
|
|
|
|
* Author - Joey Pollack
|
|
|
|
|
* Date - 2022/05/23 (y/m/d)
|
|
|
|
|
* Mod Date - 2022/05/23 (y/m/d)
|
|
|
|
|
* Description - Provides functionality to work with world entities
|
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
|
|
#include "entity.h"
|
|
|
|
|
#include "world.h"
|
|
|
|
|
|
|
|
|
|
namespace lunarium
|
|
|
|
|
{
|
|
|
|
|
Entity::Entity(World& w)
|
|
|
|
|
: mHandle(entt::null), mWorld(w)
|
|
|
|
|
{
|
|
|
|
|
mUUID = UUID::GetNewID();
|
|
|
|
|
Init();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Entity::Entity(World& w, LUUID uuid, entt::entity handle)
|
|
|
|
|
: mHandle(handle), mWorld(w), mUUID(uuid)
|
|
|
|
|
{
|
|
|
|
|
Init();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Entity::Init()
|
|
|
|
|
{
|
|
|
|
|
mHandle = mWorld.GetEntityRegistry()->create();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
LUUID Entity::GetUUID() const
|
|
|
|
|
{
|
|
|
|
|
return mUUID;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool Entity::HasChildren() const
|
|
|
|
|
{
|
|
|
|
|
return mChildren.size() > 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void Entity::AddChild(Entity* pChild)
|
|
|
|
|
{
|
|
|
|
|
mChildren.push_back(pChild);
|
|
|
|
|
}
|
|
|
|
|
}
|