private void Construct(GameGrid grid, ExtraGemFactory extraGemFactory, BoardUpdater boardUpdater) { this.grid = grid; this.extraGemFactory = extraGemFactory; this.boardUpdater = boardUpdater; amountExtraItemsToCreatePerColumn = new int[grid.Columns]; }
private void Construct( GameGrid grid, SwappingInputSwitch swappingInputSwitch, BoardUpdater boardUpdater, MatchSoundController matchSoundController) { this.grid = grid; this.swappingInputSwitch = swappingInputSwitch; this.boardUpdater = boardUpdater; this.matchSoundController = matchSoundController; itemsToBeDisposed = new List <Item>(); }
public void BoardUpdater_WhenGiven2DArratAndCoordinates_ReturnsUpdated2DArray() { string[,] star2DArray = new string[3, 3] { { "*", "*", "*" }, { "*", "*", "*" }, { "*", "*", "*" } }; string character = "X"; int[] coordinates = new int[] { 1, 1 }; BoardUpdater myUpdatedBoard = new BoardUpdater(star2DArray); string[,] result = myUpdatedBoard.UpdateBoard(character, coordinates); Assert.Equal(new string[3, 3] { { "*", "*", "*" }, { "*", "X", "*" }, { "*", "*", "*" } }, result); }
public bool ChooseDestination(int slotIdDestination, out string message) { // bool isPlayerGoingForwards = IsPlayerGoingForward.Validate(Move.SlotIdSource.Value, slotIdDestination, Turn); bool isDestinationInsideBorders = IsSlotIdDestinationValid.Validate(slotIdDestination, BlackPlayer, WhitePlayer, Turn); bool isSlotBlocked = IsSlotBlockedByOpponent.Validate(slotIdDestination, Turn, Board); bool isCubeStepExist = CubeStepExistValidator.Validate(Move.SlotIdSource.Value, slotIdDestination, BlackPlayer, WhitePlayer, Turn, Steps); message = TempGamePrinter.ChooseDestinationMessages(isPlayerGoingForwards, isDestinationInsideBorders, isSlotBlocked, isCubeStepExist); if (isPlayerGoingForwards == false || isDestinationInsideBorders == false || isSlotBlocked == true || isCubeStepExist == false) { return(false); } //update current move details: Move.SlotIdDestination = slotIdDestination; //updates: //update board : BoardUpdater.Update(Move.SlotIdSource.Value, Move.SlotIdDestination.Value, Board, Turn); //update each user state : PlayersStateUpdater.Update(BlackPlayer, WhitePlayer, Board); //update steps left: StepsLeftUpdater.Update(Move.SlotIdSource.Value, Move.SlotIdDestination.Value, Steps, Turn); //update turn : Turn = TurnUpdater.Update(Turn, BlackPlayer, WhitePlayer, Steps); //event raise: if (Steps.Count == 0) { StepsEnded?.Invoke(this, EventArgs.Empty); } //refresh move: Move.RefreshForNewMove(); return(true); }
public void Construct(Vector2 initialPosition, BoardUpdater boardUpdater) { transform.position = initialPosition; this.boardUpdater = boardUpdater; }
private void Construct(BoardUpdater boardUpdater) { this.boardUpdater = boardUpdater; }