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

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

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

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

            case RoomFlags.ConnDestructible:
                tile = new DungeonTile {
                    TileType = LabTemplate.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);
            }

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