public static TiledProjectImporter CreateFromFile(string mapFilePath, string objectTypesFilePath = null)
        {
            var mapSerializer = new XmlSerializer(typeof(Map));

            Map map;

            Objecttypes objecttypes = new Objecttypes {
                Objecttype = new List <Objecttype>()
            };

            using (var reader = new StreamReader(mapFilePath))
            {
                map = (Map)mapSerializer.Deserialize(reader);
            }

            if (!string.IsNullOrEmpty(objectTypesFilePath))
            {
                var objecttypesSerializer = new XmlSerializer(typeof(Objecttypes));

                using (var reader = new StreamReader(objectTypesFilePath))
                {
                    objecttypes = (Objecttypes)objecttypesSerializer.Deserialize(reader);
                }
            }

            return(new TiledProjectImporter(map, objecttypes));
        }
        public TiledProjectImporter(Map map, Objecttypes objecttypes)
        {
            var objecttypesByName = objecttypes
                                    .Objecttype
                                    .ToDictionary(ot => ot.Name, ot => ot, StringComparer.InvariantCultureIgnoreCase);

            var prefabLookup = AssetDatabase
                               .GetAllAssetPaths()
                               .Where(path => path.EndsWith(".prefab"))
                               .ToDictionary(p => GetPrefabName(p), p => p, StringComparer.InvariantCultureIgnoreCase);

            _gameObjectFactories = new AbstractGameObjectFactory[]
            {
                new PlatformColliderFactory(map, prefabLookup, objecttypesByName),
                new OneWayPlatformColliderFactory(map, prefabLookup, objecttypesByName),
                new DeathHazardFactory(map, prefabLookup, objecttypesByName),
                new LayerPrefabFactory(map, prefabLookup, objecttypesByName),
                new TiledObjectPrefabFactory(map, prefabLookup, objecttypesByName),
                new CameraModifierFactory(map, prefabLookup, objecttypesByName)
            };
        }