Esempio n. 1
0
        public void ValidateCellSize()
        {
            var(_, _, grid) = CreateTextureSet(32, 16, TileType.Isometric);

            var painter = new IsoTilePainter(prefs, grid);
            var area    = painter.GetTileArea(grid.Tiles[0]);

            area.Should().Be(new IntRect(0, 0, 32, 16));
        }
Esempio n. 2
0
        public void ValidateIsoShapeNonStandard()
        {
            var(_, _, grid) = CreateTextureSet(30, 16, TileType.Isometric);

            var painter = new IsoTilePainter(prefs, grid);
            var area    = painter.GetTileArea(grid.Tiles[0]);
            var shape   = IsoTilePainter.CreateShape(area);

            shape.Top.Should().Be(new IntPoint(15, 0));
            shape.Left.Should().Be(new IntPoint(0, 8));
            shape.Right.Should().Be(new IntPoint(29, 8));
            shape.Bottom.Should().Be(new IntPoint(15, 15));
        }
Esempio n. 3
0
        public void ValidateIsoShape()
        {
            var(_, _, grid) = CreateTextureSet(32, 16, TileType.Grid);

            var painter = new IsoTilePainter(prefs, grid);
            var area    = painter.GetTileArea(grid.Tiles[0]);
            var shape   = IsoTilePainter.CreateShape(area);

            shape.Should().BeAssignableTo <PixelPerfectIsoShape>();

            shape.Top.Should().Be(new IntPoint(16, 0));
            shape.Left.Should().Be(new IntPoint(0, 8));
            shape.Right.Should().Be(new IntPoint(31, 8));
            shape.Bottom.Should().Be(new IntPoint(16, 15));
        }
Esempio n. 4
0
        public void ValidateHighlightPositions()
        {
            var(_, _, grid)            = CreateTextureSet(32, 16, TileType.Isometric);
            grid.MatcherType           = MatcherType.CardinalFlags;
            grid.Tiles[0].SelectorHint = "0101";
            grid.Tiles[1].SelectorHint = "1010";

            var painter   = new IsoTilePainter(prefs, grid);
            var area      = painter.GetTileArea(grid.Tiles[0]);
            var baseShape = IsoTilePainter.CreateShape(area);

            baseShape.GetHighlightFor(NeighbourIndex.North).Should().BeEquivalentTo(new IntPoint(15, 0), new IntPoint(30, 7));
            baseShape.GetHighlightFor(NeighbourIndex.West).Should().BeEquivalentTo(new IntPoint(1, 7), new IntPoint(16, 0));

            var highlight = baseShape.ToHighlight();

            highlight.GetHighlightFor(NeighbourIndex.North).Should().BeEquivalentTo(new IntPoint(15, 2), new IntPoint(26, 7));
            highlight.GetHighlightFor(NeighbourIndex.West).Should().BeEquivalentTo(new IntPoint(5, 7), new IntPoint(16, 2));
        }