Ndk/BaseSystem: Added "one of" style requirement
Former-commit-id: ce4399561f4198290d639d001a6a56665baa0714
This commit is contained in:
@@ -87,11 +87,31 @@ namespace Ndk
|
||||
m_requiredComponents.UnboundedSet(index);
|
||||
}
|
||||
|
||||
template<typename ComponentType>
|
||||
void BaseSystem::RequiresAny()
|
||||
{
|
||||
static_assert(std::is_base_of<BaseComponent, ComponentType>(), "ComponentType is not a component");
|
||||
|
||||
RequiresAnyComponent(GetComponentIndex<ComponentType>());
|
||||
}
|
||||
|
||||
template<typename ComponentType1, typename ComponentType2, typename... Rest>
|
||||
void BaseSystem::RequiresAny()
|
||||
{
|
||||
RequiresAny<ComponentType1>();
|
||||
RequiresAny<ComponentType2, Rest...>();
|
||||
}
|
||||
|
||||
inline void BaseSystem::RequiresAnyComponent(ComponentIndex index)
|
||||
{
|
||||
m_requiredAnyComponents.UnboundedSet(index);
|
||||
}
|
||||
|
||||
inline void BaseSystem::AddEntity(Entity* entity)
|
||||
{
|
||||
NazaraAssert(entity, "Invalid entity");
|
||||
|
||||
m_entities.push_back(entity->CreateHandle());
|
||||
m_entities.emplace_back(entity);
|
||||
m_entityBits.UnboundedSet(entity->GetId(), true);
|
||||
|
||||
entity->RegisterSystem(m_systemIndex);
|
||||
|
||||
Reference in New Issue
Block a user