Ndk/Entity: Added Entity::Invalidate()
Former-commit-id: 8b0824982fbe0ff84acbb0db5cc1509e2c86bcbd
This commit is contained in:
parent
96bbabe334
commit
04d864e171
|
|
@ -45,6 +45,7 @@ namespace Ndk
|
||||||
|
|
||||||
void Kill();
|
void Kill();
|
||||||
|
|
||||||
|
void Invalidate();
|
||||||
bool IsValid() const;
|
bool IsValid() const;
|
||||||
|
|
||||||
void RemoveAllComponents();
|
void RemoveAllComponents();
|
||||||
|
|
|
||||||
|
|
@ -40,8 +40,7 @@ namespace Ndk
|
||||||
m_components[index] = std::move(componentPtr);
|
m_components[index] = std::move(componentPtr);
|
||||||
m_componentBits.UnboundedSet(index);
|
m_componentBits.UnboundedSet(index);
|
||||||
|
|
||||||
// On informe le monde que nous avons besoin d'une mise à jour
|
Invalidate();
|
||||||
m_world->Invalidate(m_id);
|
|
||||||
|
|
||||||
// On récupère le component et on informe les composants existants du nouvel arrivant
|
// On récupère le component et on informe les composants existants du nouvel arrivant
|
||||||
BaseComponent& component = *m_components[index].get();
|
BaseComponent& component = *m_components[index].get();
|
||||||
|
|
@ -66,6 +65,12 @@ namespace Ndk
|
||||||
m_world->KillEntity(this);
|
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()
|
void Entity::RemoveAllComponents()
|
||||||
{
|
{
|
||||||
for (unsigned int i = m_componentBits.FindFirst(); i != m_componentBits.npos; i = m_componentBits.FindNext(i))
|
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();
|
m_components.clear();
|
||||||
|
|
||||||
// On informe le monde que nous avons besoin d'une mise à jour
|
Invalidate();
|
||||||
m_world->Invalidate(m_id);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Entity::RemoveComponent(ComponentIndex index)
|
void Entity::RemoveComponent(ComponentIndex index)
|
||||||
|
|
@ -97,8 +101,7 @@ namespace Ndk
|
||||||
m_components[index].reset();
|
m_components[index].reset();
|
||||||
m_componentBits.Reset(index);
|
m_componentBits.Reset(index);
|
||||||
|
|
||||||
// On informe le monde que nous avons besoin d'une mise à jour
|
Invalidate();
|
||||||
m_world->Invalidate(m_id);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue