ECS/Project/Project/ECS/EntityManager/EntityManager.cpp
//	Check if the specified entity has the required components for the specified component type.
Check if the specified entity has the required components for the specified component type.
Check if the specified entity has the required components for the specified component type .
bool EntityManager::checkComponentRequirements(const long int & givenEntity, const ComponentType & componentType)
{
	std::shared_ptr<Entity> entity = getEntity(givenEntity);
	bool hasComponentRequirements = false;
	if (entity != NULL)
	{
		if (!entity->getDestroyed())
		{
			switch (componentType)
			{
			case ComponentType::HIERARCHY_COMPONENT:
			{
				hasComponentRequirements = entity->hasComponents((long int)ComponentTypeRequirement::HIERARCHY_COMPONENT_REQUIREMENTS);
				break;
			}
			case ComponentType::TRANSFORM_COMPONENT:
			{
				hasComponentRequirements = entity->hasComponents((long int)ComponentTypeRequirement::TRANSFORM_COMPONENT_REQUIREMENTS);
				break;
			}
			case ComponentType::CAMERA_COMPONENT:
			{
				hasComponentRequirements = entity->hasComponents((long int)ComponentTypeRequirement::CAMERA_COMPONENT_REQUIREMENTS);
				break;
			}
			case ComponentType::SPEED_COMPONENT:
			{
				hasComponentRequirements = entity->hasComponents((long int)ComponentTypeRequirement::SPEED_COMPONENT_REQUIREMENTS);
				break;
			}
			case ComponentType::GEOMETRY_COMPONENT:
			{
				hasComponentRequirements = entity->hasComponents((long int)ComponentTypeRequirement::GEOMETRY_COMPONENT_REQUIREMENTS);
				break;
			}
			case ComponentType::RENDERING_COMPONENT:
			{
				hasComponentRequirements = entity->hasComponents((long int)ComponentTypeRequirement::RENDERING_COMPONENT_REQUIREMENTS);
				break;
			}
			case ComponentType::SELECTION_COMPONENT:
			{
				hasComponentRequirements = entity->hasComponents((long int)ComponentTypeRequirement::SELECTION_COMPONENT_REQUIREMENTS);
				break;
			}
			case ComponentType::MOVEMENT_RESPONSE_COMPONENT:
			{
				hasComponentRequirements = entity->hasComponents((long int)ComponentTypeRequirement::MOVEMENT_RESPONSE_COMPONENT_REQUIREMENTS);
				break;
			}
			default:
				hasComponentRequirements = false;
				break;
			}
		}
		else
		{
			hasComponentRequirements = false;
		}
	}
	else
	{
		hasComponentRequirements = false;
	}
	return hasComponentRequirements;
}
bool EntityManager :: checkComponentRequirements ( const long int & givenEntity , const ComponentType & componentType ) { std :: shared_ptr < Entity > entity = getEntity ( givenEntity ) ; bool hasComponentRequirements = false ; if ( entity != NULL ) { if ( ! entity -> getDestroyed ( ) ) { switch ( componentType ) { case ComponentType :: HIERARCHY_COMPONENT : { hasComponentRequirements = entity -> hasComponents ( ( long int ) ComponentTypeRequirement :: HIERARCHY_COMPONENT_REQUIREMENTS ) ; break ; } case ComponentType :: TRANSFORM_COMPONENT : { hasComponentRequirements = entity -> hasComponents ( ( long int ) ComponentTypeRequirement :: TRANSFORM_COMPONENT_REQUIREMENTS ) ; break ; } case ComponentType :: CAMERA_COMPONENT : { hasComponentRequirements = entity -> hasComponents ( ( long int ) ComponentTypeRequirement :: CAMERA_COMPONENT_REQUIREMENTS ) ; break ; } case ComponentType :: SPEED_COMPONENT : { hasComponentRequirements = entity -> hasComponents ( ( long int ) ComponentTypeRequirement :: SPEED_COMPONENT_REQUIREMENTS ) ; break ; } case ComponentType :: GEOMETRY_COMPONENT : { hasComponentRequirements = entity -> hasComponents ( ( long int ) ComponentTypeRequirement :: GEOMETRY_COMPONENT_REQUIREMENTS ) ; break ; } case ComponentType :: RENDERING_COMPONENT : { hasComponentRequirements = entity -> hasComponents ( ( long int ) ComponentTypeRequirement :: RENDERING_COMPONENT_REQUIREMENTS ) ; break ; } case ComponentType :: SELECTION_COMPONENT : { hasComponentRequirements = entity -> hasComponents ( ( long int ) ComponentTypeRequirement :: SELECTION_COMPONENT_REQUIREMENTS ) ; break ; } case ComponentType :: MOVEMENT_RESPONSE_COMPONENT : { hasComponentRequirements = entity -> hasComponents ( ( long int ) ComponentTypeRequirement :: MOVEMENT_RESPONSE_COMPONENT_REQUIREMENTS ) ; break ; } default : hasComponentRequirements = false ; break ; } } else { hasComponentRequirements = false ; } } else { hasComponentRequirements = false ; } return hasComponentRequirements ; }
Check if the specified entity has the required components for the specified component type.
Check if the specified entity has the required components for the specified component type .
//	Get the Entity. //	Initialize to false. //	Check if the entity exists. //	Check if the entity was destroyed. //	Switch on the Component Type. //	Check for HIERARCHY Component Type. //	Check for TRANSFORM Component Type. //	Check for CAMERA Component Type. //	Check for the SPEED Component Type. //	Check for the GEOMETRY Component Type. //	Check for the RENDERING Component Type. //	Check for the SELECTION Component Type. //	Check for the MOVEMENT RESPONSE Component Type. //	False if the Type was not recognized. //	Set the Component Requirements Flag to false. //	Set the Component Requirements Flag to false. //	Return whether or not we need the components.