Exemple #1
0
        public void GetMovableTilesTest()
        {
            List <Point> answerPoints = new List <Point>
            {
                new Point(0, 3), new Point(1, 2), new Point(1, 4), new Point(2, 1),
                new Point(2, 3), new Point(2, 5), new Point(3, 0), new Point(3, 2),
                new Point(3, 4), new Point(3, 6), new Point(4, 1), new Point(4, 3),
                new Point(4, 5), new Point(5, 2), new Point(5, 4), new Point(6, 3)
            };

            Board board = TileFinder.GetMovableTiles(new Point(3, 3), 3, new Board(7, 7));

            List <Point> movablePoints = new List <Point>();

            for (int x = 0; x < board.Points.GetLength(0); x++)
            {
                for (int y = 0; y < board.Points.GetLength(1); y++)
                {
                    if (board.Points[x, y].isMovable)
                    {
                        movablePoints.Add(board.Points[x, y]);
                    }
                }
            }

            //Assert.AreEqual(movablePoints.Count, answerPoints.Count);

            for (int i = 0; i < movablePoints.Count; i++)
            {
                Assert.IsTrue(movablePoints[i].Equal(answerPoints[i]));
            }
        }
    public void FindTiles()
    {
        Node HorsePosNode = grid.NodeFromWorldPoint(transform.position);

        //print("Grid X: " + grid.gridSizeX + "Grid Y: " + grid.gridSizeY);

        movableTiles = TileFinder.GetMovableTiles(HorsePosNode, DiceNumber, grid);
    }