Пример #1
0
 public override void Rasterize(BitmapRasterizer <DungeonTile> rasterizer, Random rand)
 {
     rasterizer.Copy(MadLabTemplate.MapTemplate, template, Pos);
     MadLabTemplate.DrawSpiderWeb(rasterizer, Bounds, rand);
 }
Пример #2
0
        public override void Rasterize(BitmapRasterizer <DungeonTile> rasterizer, Random rand)
        {
            rasterizer.Copy(MadLabTemplate.MapTemplate, current.Bounds, Pos);

            if ((current.Flags & RoomFlags.Evil) == 0)
            {
                MadLabTemplate.CreateEnemies(rasterizer, Bounds, rand);
            }

            var         flags = current.Flags & RoomFlags.ConnectionMask;
            DungeonTile?tile  = null;

            switch (flags)
            {
            case RoomFlags.Conn_Floor:
                tile = new DungeonTile
                {
                    TileType = MadLabTemplate.LabFloor
                };
                break;

            case RoomFlags.Conn_Destructible:
                tile = new DungeonTile
                {
                    TileType = MadLabTemplate.LabFloor,
                    Object   = destWall
                };
                break;

            default:
                return;
            }

            foreach (var edge in Edges)
            {
                var direction = edge.Linkage.Direction;
                if (edge.RoomA != this)
                {
                    direction = direction.Reverse();
                }

                Point a, b;
                switch (direction)
                {
                case Direction.South:
                    a = new Point(edge.Linkage.Offset, Pos.Y + Height - 1);
                    b = new Point(a.X + 3, a.Y);
                    break;

                case Direction.North:
                    a = new Point(edge.Linkage.Offset, Pos.Y);
                    b = new Point(a.X + 3, a.Y);
                    break;

                case Direction.East:
                    a = new Point(Pos.X + Width - 1, edge.Linkage.Offset);
                    b = new Point(a.X, a.Y + 3);
                    break;

                case Direction.West:
                    a = new Point(Pos.X, edge.Linkage.Offset);
                    b = new Point(a.X, a.Y + 3);
                    break;

                default:
                    throw new ArgumentException();
                }
                rasterizer.DrawLine(a, b, tile.Value);
            }

            MadLabTemplate.DrawSpiderWeb(rasterizer, Bounds, rand);
        }