Ndk/Entity: Added Entity::Invalidate()

Former-commit-id: 8b0824982fbe0ff84acbb0db5cc1509e2c86bcbd
This commit is contained in:
Lynix 2015-05-06 22:48:36 +02:00
parent 96bbabe334
commit 04d864e171
2 changed files with 10 additions and 6 deletions

View File

@ -45,6 +45,7 @@ namespace Ndk
void Kill();
void Invalidate();
bool IsValid() const;
void RemoveAllComponents();

View File

@ -40,8 +40,7 @@ namespace Ndk
m_components[index] = std::move(componentPtr);
m_componentBits.UnboundedSet(index);
// On informe le monde que nous avons besoin d'une mise à jour
m_world->Invalidate(m_id);
Invalidate();
// On récupère le component et on informe les composants existants du nouvel arrivant
BaseComponent& component = *m_components[index].get();
@ -66,6 +65,12 @@ namespace Ndk
m_world->KillEntity(this);
}
void Entity::Invalidate()
{
// On informe le monde que nous avons besoin d'une mise à jour
m_world->Invalidate(m_id);
}
void Entity::RemoveAllComponents()
{
for (unsigned int i = m_componentBits.FindFirst(); i != m_componentBits.npos; i = m_componentBits.FindNext(i))
@ -75,8 +80,7 @@ namespace Ndk
m_components.clear();
// On informe le monde que nous avons besoin d'une mise à jour
m_world->Invalidate(m_id);
Invalidate();
}
void Entity::RemoveComponent(ComponentIndex index)
@ -97,8 +101,7 @@ namespace Ndk
m_components[index].reset();
m_componentBits.Reset(index);
// On informe le monde que nous avons besoin d'une mise à jour
m_world->Invalidate(m_id);
Invalidate();
}
}