Exemple #1
0
        public MapShape AddVisitedItem(IMultiTileShape shape)
        {
            if (VisitedShapes.Contains(shape))
            {
                return(null);
            }
            else
            {
                Point position = new Point(shape.Rect.Location.X * Constants.TilePx / Scale.X, shape.Rect.Location.Y * Constants.TilePx / Scale.Y);
                Size  size     = new Size(shape.Rect.Size.Width * Constants.TilePx / Scale.X, shape.Rect.Size.Height * Constants.TilePx / Scale.Y);
                //position = new Point(position.X + Engine.MapWindow.Canvas_MiniMap.Margin.Left,position.Y +Engine.MapWindow.Canvas_MiniMap.Margin.Top);

                Rect     rectangle = new Rect(position, size);
                MapShape t         = new MapShape((Vector)position, size, shape is RoomModule ? MapShape.TypeEnum.Room : MapShape.TypeEnum.Road);
                Tiles.Add(t);
                VisitedShapes.Add(shape);

                if (shape is RoomModule)
                {
                    RoomModule s = (RoomModule)shape;
                    s.Roads.ForEach(road => AddVisitedItem(road));
                }

                return(t);
            }
        }
Exemple #2
0
        public static void AddTile(this IMultiTileShape multiTileShape, Vector position, Tile.TypeEnum type)
        {
            Tile t = new Tile(position, multiTileShape, type, multiTileShape is RoomModule);

            if (multiTileShape.Tiles.ContainsKey(t.Position))
            {
                return;
            }
            multiTileShape.Tiles.Add(t.Position, t);

            if (t.Type == Tile.TypeEnum.Wall)
            {
                multiTileShape.WallTiles.Add(t);
            }
        }