ECS/Project/Project/ECS/EntityManager/EntityManager.cpp
//	Create a component of the specifed type.
Create a component of the specifed type.
Create a component of the specifed type .
std::shared_ptr<Component> EntityManager::createComponent(const ComponentType & componentType)
{
	std::shared_ptr<Component> newComponent = NULL;
	switch (componentType)
	{
	case ComponentType::HIERARCHY_COMPONENT:
	{
		newComponent = std::make_shared<HierarchyComponent>();
		break;
	}
	case ComponentType::TRANSFORM_COMPONENT:
	{
		newComponent = std::make_shared<TransformComponent>();
		break;
	}
	case ComponentType::CAMERA_COMPONENT:
	{
		newComponent = std::make_shared<CameraComponent>();
		break;
	}
	case ComponentType::SPEED_COMPONENT:
	{
		newComponent = std::make_shared<SpeedComponent>();
		break;
	}
	case ComponentType::GEOMETRY_COMPONENT:
	{
		newComponent = std::make_shared<GeometryComponent>();
		break;
	}
	case ComponentType::RENDERING_COMPONENT:
	{
		newComponent = std::make_shared<RenderingComponent>();
		break;
	}
	case ComponentType::SELECTION_COMPONENT:
	{
		newComponent = std::make_shared<SelectionComponent>();
		break;
	}
	case ComponentType::MOVEMENT_RESPONSE_COMPONENT:
	{
		newComponent = std::make_shared<MovementResponseComponent>();
		break;
	}
	default:
	{
		newComponent = NULL;
		break;
	}
	}
	return newComponent;
}
std :: shared_ptr < Component > EntityManager :: createComponent ( const ComponentType & componentType ) { std :: shared_ptr < Component > newComponent = NULL ; switch ( componentType ) { case ComponentType :: HIERARCHY_COMPONENT : { newComponent = std :: make_shared < HierarchyComponent > ( ) ; break ; } case ComponentType :: TRANSFORM_COMPONENT : { newComponent = std :: make_shared < TransformComponent > ( ) ; break ; } case ComponentType :: CAMERA_COMPONENT : { newComponent = std :: make_shared < CameraComponent > ( ) ; break ; } case ComponentType :: SPEED_COMPONENT : { newComponent = std :: make_shared < SpeedComponent > ( ) ; break ; } case ComponentType :: GEOMETRY_COMPONENT : { newComponent = std :: make_shared < GeometryComponent > ( ) ; break ; } case ComponentType :: RENDERING_COMPONENT : { newComponent = std :: make_shared < RenderingComponent > ( ) ; break ; } case ComponentType :: SELECTION_COMPONENT : { newComponent = std :: make_shared < SelectionComponent > ( ) ; break ; } case ComponentType :: MOVEMENT_RESPONSE_COMPONENT : { newComponent = std :: make_shared < MovementResponseComponent > ( ) ; break ; } default : { newComponent = NULL ; break ; } } return newComponent ; }
Create a component of the specifed type.
Create a component of the specifed type .
//	Switch cases to create the appropriate component. //	Check for HIERARCHY Component Type. //	Check for TRANSFORM Component Type. //	Check for CAMERA Component Type. //	Check for SPEED Component Type. //	Check for GEOMETRY Component Type. //	Check for RENDERING Component Type. //	Check for SELECTION Component Type. //	Check for MOVEMENT RESPONSE Component Type. //	Set the New Component to NULL if No Case Matches. //	Return the New Component.