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); }
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); }
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()); }