MCPcopy Create free account
hub / github.com/NazaraEngine/NazaraEngine / DestroyComponent

Method DestroyComponent

SDK/src/NDK/Entity.cpp:200–217  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

198 */
199
200 void Entity::DestroyComponent(ComponentIndex index)
201 {
202 if (HasComponent(index))
203 {
204 // We get the component and we alert existing components of the deleted one
205 BaseComponent& component = *m_components[index].get();
206 for (std::size_t i = m_componentBits.FindFirst(); i != m_componentBits.npos; i = m_componentBits.FindNext(i))
207 {
208 if (i != index)
209 m_components[i]->OnComponentDetached(component);
210 }
211
212 component.SetEntity(nullptr);
213
214 m_components[index].reset();
215 m_componentBits.Reset(index);
216 }
217 }
218
219}

Callers 1

UpdateMethod · 0.80

Calls 2

OnComponentDetachedMethod · 0.45
ResetMethod · 0.45

Tested by

no test coverage detected