ECS/Project/Project/ECS/EntityManager/EntityManager.cpp
//	Remove the component from the entity.
Remove the component from the entity.
Remove the component from the entity .
void EntityManager::removeComponentFromEntity(const long int & givenEntity, const ComponentType & componentTypeSignature)
{
	std::shared_ptr<Entity> entity = getEntity(givenEntity);
	if (entity != NULL)
	{
		if (!entity->getDestroyed())
		{
			if (entity->hasComponents((long int)componentTypeSignature))
			{
				removeComponentTypeDependencies(givenEntity, componentTypeSignature);
				removeEntityFromComponentTypeList(givenEntity, componentTypeSignature);
				eventDispatcher->dispatchToEventQueue(EventType::COMPONENT_DESTROYED, ModuleType::ENTITY_MANAGER, componentTypeSignature, givenEntity);
				entity->removeComponent(componentTypeSignature);
			}
		}
	}
}
void EntityManager :: removeComponentFromEntity ( const long int & givenEntity , const ComponentType & componentTypeSignature ) { std :: shared_ptr < Entity > entity = getEntity ( givenEntity ) ; if ( entity != NULL ) { if ( ! entity -> getDestroyed ( ) ) { if ( entity -> hasComponents ( ( long int ) componentTypeSignature ) ) { removeComponentTypeDependencies ( givenEntity , componentTypeSignature ) ; removeEntityFromComponentTypeList ( givenEntity , componentTypeSignature ) ; eventDispatcher -> dispatchToEventQueue ( EventType :: COMPONENT_DESTROYED , ModuleType :: ENTITY_MANAGER , componentTypeSignature , givenEntity ) ; entity -> removeComponent ( componentTypeSignature ) ; } } } }
Remove the component from the entity.
Remove the component from the entity .
//	Return the entity and check if it exists. //	Check if the entity has already been destroyed. //	Check if the entity has the requested component. //	Check for Component Dependency. //	Find the entity and remove it from the list of entities. //	Dispatch the Event to the EventQueue. //	Remove the appropriate component.