示例#1
0
        public bool TryPutOnMap(Map map, Location location)
        {
            Location = location;
            var tiles = GetTiles();

            //                     out of bounds                    intersection
            if (tiles.Any(t => !map.Contains(t.Coords) || map.GetTile(t.Coords) is not null))
            {
                Location = new(0, 0);
                return(false);
            }

            if (map is ShowcaseMap sm)
            {
                sm.Figure = this;
            }
            else
            if (map is GameMap gm)
            {
                gm.AddFigure(this);
            }

            return(true);
        }