示例#1
0
    void SetOuterWalls()
    {
        for (int i = 0; i < _mazeCells.Count; ++i)
        {
            // West
            if (_mazeShaper.IsWestBorderCell(i))
            {
                _mazeCells[i].SetOuterWallAsBorder(WallIndex.WestWall);
            }

            // South
            if (_mazeShaper.IsSouthBorderCell(i))
            {
                _mazeCells[i].SetOuterWallAsBorder(WallIndex.SouthWall);
            }

            // East
            if (_mazeShaper.IsEastBorderCell(i))
            {
                _mazeCells[i].SetOuterWallAsBorder(WallIndex.EastWall);
            }

            // North
            if (_mazeShaper.IsNorthBorderCell(i))
            {
                _mazeCells[i].SetOuterWallAsBorder(WallIndex.NorthWall);
            }
        }
    }
示例#2
0
    public void IsBorderCellTest(int maxY, int maxX,
                                 int cellIndex, WallIndex wallIndex, bool expectedResult)
    {
        // Arrange
        MazeShaperZ shaper = new MazeShaperZ(maxY, maxX);

        // Act
        bool result = false;

        if (wallIndex == WallIndex.NorthWall)
        {
            result = shaper.IsNorthBorderCell(cellIndex);
        }

        if (wallIndex == WallIndex.EastWall)
        {
            result = shaper.IsEastBorderCell(cellIndex);
        }

        if (wallIndex == WallIndex.SouthWall)
        {
            result = shaper.IsSouthBorderCell(cellIndex);
        }

        if (wallIndex == WallIndex.WestWall)
        {
            result = shaper.IsWestBorderCell(cellIndex);
        }

        // Assert
        Assert.That(expectedResult, Is.EqualTo(result));
    }