Beispiel #1
0
        public void RemoveMapStruct(IMapStructure mapStruct)
        {
            var layer = _layers[mapStruct.MapLayerName];

            foreach (var spot in mapStruct.MapSpots)
            {
                var tile = layer.GetTileAt(spot);
                tile.RemoveStruct(mapStruct.Id);
            }
            _mapStructs.Remove(mapStruct.Id);
        }
Beispiel #2
0
        public void AddMapStructure(IMapStructure mapStructure)
        {
            if (mapStructure == null)
            {
                throw new ArgumentNullException(nameof(mapStructure));
            }


            if (CanAddMapStructure(mapStructure.MapLayerName, mapStructure.MapStructDef, mapStructure.Anchor, mapStructure.Rotation))
            {
                var layer = GetLayer(mapStructure.MapLayerName);
                _mapStructs.Add(mapStructure.Id, mapStructure);
                foreach (var spot in mapStructure.MapSpots)
                {
                    var tile = layer.GetTileAt(spot);
                    tile.AddMapStruct(mapStructure.Id);
                }
            }
            else
            {
                throw new Exception("Failed to add map struct. CanAddMapStructure should have been called first.");
            }
        }