Esempio n. 1
0
GameObject* GameObjectFactory::create( std::string typeID )
{
	std::map<std::string, BaseCreator*>::iterator it = m_creators.find(typeID);

	if( it == m_creators.end() )
	{
		std::cout << "could not find type: " << typeID << "\n";
		return NULL;
	}
	
	BaseCreator* pCreator = (*it).second;
	return pCreator->createGameObject();
}
GameObject* GameObjectFactory::create(std::string typeID)
{
	std::map<std::string, BaseCreator*>::iterator it =
		objectCreators.find(typeID);

	if (it == objectCreators.end())
	{
		printf("could not find type: %s\n", typeID.c_str());
		return NULL;
	}
	BaseCreator* pCreator = (*it).second;
	return pCreator->createGameObject();
}