Exemplo n.º 1
0
        public IEnumerable <MapStructSide> GetOccupiedSides(MapSpot spot)
        {
            if (!MapSpots.Any(s => spot.X == s.X && spot.Y == s.Y))
            {
                return(null);
            }

            var print = _rotationMapping.Where(p => p.Value.X == spot.X && p.Value.Y == spot.Y).SingleOrDefault().Key;

            if (print == null)
            {
                return(null);
            }

            var sides = _def.OccupiesSides[print];

            if (sides == null)
            {
                return(null);
            }

            var rotated = MapStructHelper.RotateOccupiedSides(sides, Rotation).ToList();

            return(rotated);
        }
Exemplo n.º 2
0
        public BaseMapStructure(MapStructDef def, string layerName, MapSpot anchor, IMapController controller, MapRotation rotation) : base(def)
        {
            MapController = controller ?? throw new ArgumentNullException(nameof(controller));
            Anchor        = anchor ?? throw new ArgumentNullException(nameof(anchor));
            MapLayerName  = layerName;

            _def = def ?? throw new ArgumentNullException(nameof(def));
            MapStructValidator.ValidateDef(def);
            _rotationMapping = MapStructHelper.FootprintToMapSpotsDictionary(def.Footprint, rotation, anchor);
        }