/// <summary> /// Creates entities from a single layer for any tile with the EntityToCreate property. /// </summary> /// <param name="mapLayer">The layer to create entities from.</param> /// <param name="layeredTileMap">The map which contains the mapLayer instance.</param> public static void CreateEntitiesFrom(MapDrawableBatch mapLayer, LayeredTileMap layeredTileMap) { var entitiesToRemove = new List <string>(); CreateEntitiesFrom(entitiesToRemove, mapLayer, layeredTileMap.TileProperties); foreach (var entityToRemove in entitiesToRemove) { string remove = entityToRemove; mapLayer.RemoveTiles(t => t.Any(item => (item.Name == "EntityToCreate" || item.Name == "Type") && item.Value as string == remove), layeredTileMap.TileProperties); } }
/// <summary> /// Creates entities from a single layer for any tile with the EntityToCreate property. /// </summary> /// <param name="mapLayer">The layer to create entities from.</param> /// <param name="layeredTileMap">The map which contains the mapLayer instance.</param> public static void CreateEntitiesFrom(MapDrawableBatch mapLayer, LayeredTileMap layeredTileMap) { var entitiesToRemove = new List <string>(); CreateEntitiesFrom(entitiesToRemove, mapLayer, layeredTileMap.TileProperties, layeredTileMap.WidthPerTile ?? 16); if (CurrentSettings.RemoveTileObjectsAfterEntityCreation) { foreach (var entityToRemove in entitiesToRemove) { string remove = entityToRemove; mapLayer.RemoveTiles(t => t.Any(item => (item.Name == "EntityToCreate" || item.Name == "Type") && item.Value as string == remove), layeredTileMap.TileProperties); } } }