public override void Rasterize(Room src, Room dst, Point srcPos, Point dstPos)
 {
     Default(srcPos, dstPos, new DungeonTile
     {
         TileType = PirateCaveTemplate.BrownLines
     });
 }
 public override void Rasterize(Room src, Room dst, Point srcPos, Point dstPos)
 {
     Default(srcPos, dstPos, new DungeonTile
     {
         TileType = MadLabTemplate.LabFloor
     });
 }
 public override void Rasterize(Room src, Room dst, Point srcPos, Point dstPos)
 {
     Default(srcPos, dstPos, new DungeonTile
     {
         TileType = AbyssTemplate.RedSmallChecks
     });
 }
 public static void Link(Room a, Room b, Link link)
 {
     Debug.Assert(a != b);
     var edge = new Edge
     {
         RoomA = a,
         RoomB = b,
         Linkage = link
     };
     a.Edges.Add(edge);
     b.Edges.Add(edge);
 }
 public static void UnLink(Room a, Room b)
 {
     Edge edge = null;
     foreach (var ed in a.Edges)
         if (ed.RoomA == b || ed.RoomB == b)
         {
             edge = ed;
             break;
         }
     if (edge == null)
         throw new ArgumentException();
     a.Edges.Remove(edge);
     b.Edges.Remove(edge);
 }
        internal DungeonGraph(DungeonTemplate template, Room[] rooms)
        {
            Template = template;

            int dx = int.MaxValue, dy = int.MaxValue;
            int mx = int.MinValue, my = int.MinValue;

            for (int i = 0; i < rooms.Length; i++)
            {
                var bounds = rooms[i].Bounds;

                if (bounds.X < dx)
                    dx = bounds.X;
                if (bounds.Y < dy)
                    dy = bounds.Y;

                if (bounds.MaxX > mx)
                    mx = bounds.MaxX;
                if (bounds.MaxY > my)
                    my = bounds.MaxY;
            }

            const int Pad = 4;

            Width = mx - dx + Pad * 2;
            Height = my - dy + Pad * 2;

            for (int i = 0; i < rooms.Length; i++)
            {
                var room = rooms[i];
                var pos = room.Pos;
                room.Pos = new Point(pos.X - dx + Pad, pos.Y - dy + Pad);

                foreach (var edge in room.Edges)
                {
                    if (edge.RoomA != room)
                        continue;
                    if (edge.Linkage.Direction == Direction.South || edge.Linkage.Direction == Direction.North)
                        edge.Linkage = new Link(edge.Linkage.Direction, edge.Linkage.Offset - dx + Pad);
                    else if (edge.Linkage.Direction == Direction.East || edge.Linkage.Direction == Direction.West)
                        edge.Linkage = new Link(edge.Linkage.Direction, edge.Linkage.Offset - dy + Pad);
                }
            }
            Rooms = rooms;
        }
 public override Room CreateNormal(int depth, Room prev)
 {
     return new NormalRoom(Rand.Next(8, 15), Rand.Next(8, 15));
 }
 public override Room CreateSpecial(int depth, Room prev)
 {
     throw new InvalidOperationException();
 }
 public override Room CreateTarget(int depth, Room prev)
 {
     return new BossRoom(10);
 }
 public abstract Room CreateSpecial(int depth, Room prev);
 public abstract Room CreateNormal(int depth, Room prev);
 public abstract Room CreateTarget(int depth, Room prev);
 public override Room CreateSpecial(int depth, Room prev)
 {
     return new TreasureRoom();
 }
 public override Room CreateNormal(int depth, Room prev)
 {
     return new NormalRoom(8, 8);
 }
 public virtual void Rasterize(Room src, Room dst, Point srcPos, Point dstPos)
 {
 }
        private void RenderBossEdge(Room src, Room dst, Direction direction, int offset)
        {
            switch (direction)
            {
                case Direction.North:
                    RenderLavaGround(
                        new Point(offset, dst.Pos.Y + 35),
                        new Point(offset, src.Pos.Y));
                    break;

                case Direction.South:
                    RenderLavaGround(
                        new Point(offset, src.Pos.Y + src.Height),
                        new Point(offset, dst.Pos.Y + 10));
                    break;

                case Direction.West:
                    RenderLavaGround(
                        new Point(dst.Pos.X + 35, offset),
                        new Point(src.Pos.X, offset));
                    break;

                case Direction.East:
                    RenderLavaGround(
                        new Point(src.Pos.X + src.Width, offset),
                        new Point(dst.Pos.X + 10, offset));
                    break;

                default:
                    throw new ArgumentException();
            }
        }
 public override Room CreateNormal(int depth, Room prev)
 {
     var rm = new NormalRoom(prev as NormalRoom, Rand, generatedEvilRoom);
     if ((rm.Flags & NormalRoom.RoomFlags.Evil) != 0)
         generatedEvilRoom = true;
     return rm;
 }