private void Construct()
        {
            WinEventControllerImplementation winEvent = new WinEventControllerImplementation();

            winEvent.AddListener(HandleEndGame);
            winController.Construct(slotGrid.Width * slotGrid.Height - 1, winEvent);
            slotFactory.Construct();
            pieceFactory.Construct();
            slotSorting = new SlotSortingImplementation(slotGrid);
        }
Exemple #2
0
        public void SetEmptyStateToRandomSlot()
        {
            Game.GridImplementation slotGrid    = CreateSlotGrid();
            SlotSorting             slotSorting = CreateSlotSortingToGrid(slotGrid);

            GameObject randomSlotObject = slotSorting.GetRandomEmptySlotObject();
            PieceDestinationController randomSlotPieceDestinationController = randomSlotObject.GetComponent <PieceDestinationController>();

            Assert.IsTrue(randomSlotPieceDestinationController.State is EmptyState);
            Assert.IsNull(randomSlotPieceDestinationController.Piece);
        }
Exemple #3
0
        public void RandomEmptySlotHasMovableNeighbors()
        {
            Game.GridImplementation slotGrid    = CreateSlotGrid();
            SlotSorting             slotSorting = CreateSlotSortingToGrid(slotGrid);

            GameObject        randomSlotObject = slotSorting.GetRandomEmptySlotObject();
            GridItemMover     slotMover        = randomSlotObject.GetComponent <GridItemMover>();
            List <GameObject> slotNeighbors    = slotGrid.GetItemNeighbors(slotMover);

            Assert.Greater(slotNeighbors.Count, 1);
            foreach (GameObject slotNeighbor in slotNeighbors)
            {
                PieceDestinationController currentSlotPieceDestinationController = slotNeighbor.GetComponent <PieceDestinationController>();

                Assert.IsTrue(currentSlotPieceDestinationController.CanMovePiece());
            }
        }
        private GameObject GetEmptySlotObjectFromGrid(Game.Grid grid)
        {
            SlotSorting slotSorting = CreateSlotSortingToGrid(grid);

            return(slotSorting.GetRandomEmptySlotObject());
        }