/// <summary> /// Creates the proper map object layer based on the layer name such as collidables and path nodes. /// </summary> /// <param name="layer"></param> /// <param name="orientation"></param> /// <returns></returns> private MapObjectLayer CreateObjectLayer(LayerContent layer, Orientation orientation) { if (layer == null) throw new ArgumentNullException("layer"); ObjectLayerContent objectLayerContent = layer as ObjectLayerContent; MapObjectLayer mapObjectLayer = new MapObjectLayer(objectLayerContent.Name); foreach (ObjectContent objectContent in objectLayerContent.MapObjects) { MapObject mapObject = new MapObject(objectContent.Name, objectContent.Bounds, orientation, objectContent.Properties); mapObjectLayer.AddMapObject(mapObject); } return mapObjectLayer; }
/// <summary> /// Adds a single object to the layer's collection of objects /// </summary> /// <param name="mapObject"></param> public void AddMapObject(MapObject mapObject) { mapObjects.Add(mapObject); }