Sdk/Entity: Add DropComponent method

This commit is contained in:
Lynix
2019-10-21 19:04:55 +02:00
parent 9161886cc8
commit dac4f7806a
5 changed files with 45 additions and 32 deletions

View File

@@ -64,6 +64,15 @@ namespace Ndk
* \remark Produces a NazaraAssert if component is not available in this entity
*/
template<typename ComponentType>
std::unique_ptr<BaseComponent> Entity::DropComponent()
{
static_assert(std::is_base_of<BaseComponent, ComponentType>::value, "ComponentType is not a component");
ComponentIndex index = GetComponentIndex<ComponentType>();
return DropComponent(index);
}
template<typename ComponentType>
ComponentType& Entity::GetComponent()
{