public CellMarkupStructure GetCellIdsOnWithCanBeDraged(List <BoardCell> cellIdsList, BoardCell boardCell) { CellMarkupStructure localCellIdsListBYType = new CellMarkupStructure().Init(); FigureTeamType teamType = figure.TeamType; BoardCellId currentCellId = boardCell.CellId; int index = cellIdsList.FindIndex(c => c.CellId == boardCell.CellId); if (index != -1) { CellMarkupStructure forwardFork = GetForwardKnightFork(cellIdsList, index); CellMarkupStructure backwardFork = GetBackwardKnightFork(cellIdsList, index); CellMarkupStructure rightFork = GetRightKnightFork(cellIdsList, index); CellMarkupStructure leftFork = GetLeftKnightFork(cellIdsList, index); localCellIdsListBYType.canBeCapture = localCellIdsListBYType.canBeCapture .Concat(forwardFork.canBeCapture) .Concat(backwardFork.canBeCapture) .Concat(rightFork.canBeCapture) .Concat(leftFork.canBeCapture) .ToList(); localCellIdsListBYType.canBeDreggedTo = localCellIdsListBYType.canBeDreggedTo .Concat(forwardFork.canBeDreggedTo) .Concat(backwardFork.canBeDreggedTo) .Concat(rightFork.canBeDreggedTo) .Concat(leftFork.canBeDreggedTo) .ToList(); } return(localCellIdsListBYType); }
public RewindListItem(int index, BoardCellId from, BoardCellId to, bool isSelected = false) { Index = index; From = from; To = to; IsSelected = isSelected; }
public CellMarkupStructure GetCellIdsOnWithCanBeDraged(List <BoardCell> cellIdsList, BoardCell boardCell) { CellMarkupStructure localCellIdsListBYType = new CellMarkupStructure().Init(); FigureTeamType teamType = figure.TeamType; BoardCellId currentCellId = boardCell.CellId; int index = cellIdsList.FindIndex(c => c.CellId == boardCell.CellId); if (teamType == FigureTeamType.white) { CellMarkupStructure leftForward = GetForwardLeftMoveCellsIdByCount(cellIdsList, index, 1, false, true); CellMarkupStructure rightForward = GetForwardRightMoveCellsIdByCount(cellIdsList, index, 1, false, true); CellMarkupStructure forward = GetForwardMoveCellSIdByCount(cellIdsList, index, FirsMove ? 2 : 1, true, false); localCellIdsListBYType = forward; localCellIdsListBYType.canBeCapture = localCellIdsListBYType.canBeCapture.Concat(leftForward.canBeCapture).Concat(rightForward.canBeCapture).ToList(); } else { CellMarkupStructure leftForward = GetBackwardLeftMoveCellsIdByCount(cellIdsList, index, 1, false, true); CellMarkupStructure rightForward = GetBackwardRightMoveCellsIdByCount(cellIdsList, index, 1, false, true); CellMarkupStructure forward = GetBackwardMoveCellSIdByCount(cellIdsList, index, FirsMove ? 2 : 1, true, false); localCellIdsListBYType = forward; localCellIdsListBYType.canBeCapture = localCellIdsListBYType.canBeCapture.Concat(leftForward.canBeCapture).Concat(rightForward.canBeCapture).ToList(); } return(localCellIdsListBYType); }
public void Init(BoardCellId kingFrom, BoardCellId kingTo, BoardCellId rookFrom, BoardCellId rookTo) { KingFrom = kingFrom; KingTo = kingTo; RookFrom = rookFrom; RookTo = rookTo; }
public CellMarkupStructure GetCellIdsOnWithCanBeDraged(List <BoardCell> cellIdsList, BoardCell boardCell) { CellMarkupStructure localCellIdsListBYType = new CellMarkupStructure().Init(); BoardCellId currentCellId = boardCell.CellId; int index = cellIdsList.FindIndex(c => c.CellId == boardCell.CellId); if (index != -1) { CellMarkupStructure forwardRightList = GetForwardRightMoveCellsId(cellIdsList, index); CellMarkupStructure forwardLeftList = GetForwardLeftMoveCellsId(cellIdsList, index); CellMarkupStructure backwardLeftList = GetBackwardLeftMoveCellsId(cellIdsList, index); CellMarkupStructure backwardRightList = GetBackwardRightMoveCellsId(cellIdsList, index); localCellIdsListBYType.canBeCapture = localCellIdsListBYType.canBeCapture .Concat(forwardRightList.canBeCapture) .Concat(forwardLeftList.canBeCapture) .Concat(backwardLeftList.canBeCapture) .Concat(backwardRightList.canBeCapture) .ToList(); localCellIdsListBYType.canBeDreggedTo = localCellIdsListBYType.canBeDreggedTo .Concat(forwardRightList.canBeDreggedTo) .Concat(forwardLeftList.canBeDreggedTo) .Concat(backwardLeftList.canBeDreggedTo) .Concat(backwardRightList.canBeDreggedTo) .ToList(); } return(localCellIdsListBYType); }
public RewindListItem FluentResetValues(int index, BoardCellId from, BoardCellId to, bool isSelected = false) { Index = index; From = from; To = to; IsSelected = isSelected; return(this); }
public CellMarkupStructure GetLeftCastleCellsId(List <BoardCell> cellIdsList, int index) { int rowIndex = (int)(index / 8) + 1; int lowBoundary = ((rowIndex - 1) * 8); int hieBoundary = ((rowIndex) * 8) - 1; FigureTeamType figureTeamType = figure.TeamType; CellMarkupStructure localCellMarkupStruct = new CellMarkupStructure().Init(); int localIndex = index; BoardCellId kingPosition = cellIdsList[index].CellId; CellMarkupStructure endPositionOfKingAndRook = GetLeftMoveCellsIdByCount(cellIdsList, index, 2, true, false); if (endPositionOfKingAndRook.canBeDreggedTo.Count != 2) { return(localCellMarkupStruct); } BoardCellId kingEndPosition = endPositionOfKingAndRook.canBeDreggedTo[1]; BoardCellId rookEndPosition = endPositionOfKingAndRook.canBeDreggedTo[0]; do { BoardCell boardCell = GetLeftCell(cellIdsList, ref localIndex, lowBoundary, hieBoundary); if (boardCell != null) { if (boardCell.figureOnCell == null) { continue; } else { Rook localRook = boardCell.figureOnCell.GetComponent <Rook>(); if (localRook == null) { break; } if (localRook.FirsMove) { CastleStructure localCastleStructure = new CastleStructure(); localCastleStructure.Init(kingPosition, kingEndPosition, boardCell.CellId, rookEndPosition); localCellMarkupStruct.canBeCastle.Add(localCastleStructure); break; } else { break; } } } else { break; } } while (true); return(localCellMarkupStruct); }
public CellMarkupStructure GetCellIdsOnWithCanBeDraged(List <BoardCell> cellIdsList, BoardCell boardCell) { CellMarkupStructure localCellIdsListBYType = new CellMarkupStructure().Init(); FigureTeamType teamType = figure.TeamType; BoardCellId currentCellId = boardCell.CellId; int index = cellIdsList.FindIndex(c => c.CellId == boardCell.CellId); if (index != -1) { CellMarkupStructure forward = GetForwardMoveCellSIdByCount(cellIdsList, index, 1); CellMarkupStructure backward = GetBackwardMoveCellSIdByCount(cellIdsList, index, 1); CellMarkupStructure right = GetRightMoveCellsIdByCount(cellIdsList, index, 1); CellMarkupStructure left = GetLeftMoveCellsIdByCount(cellIdsList, index, 1); CellMarkupStructure forwardLeft = GetForwardLeftMoveCellsIdByCount(cellIdsList, index, 1); CellMarkupStructure forwardRight = GetForwardRightMoveCellsIdByCount(cellIdsList, index, 1); CellMarkupStructure backwardLeft = GetBackwardLeftMoveCellsIdByCount(cellIdsList, index, 1); CellMarkupStructure backwardRight = GetBackwardRightMoveCellsIdByCount(cellIdsList, index, 1); localCellIdsListBYType.canBeCapture = localCellIdsListBYType.canBeCapture .Concat(forward.canBeCapture) .Concat(backward.canBeCapture) .Concat(right.canBeCapture) .Concat(left.canBeCapture) .Concat(forwardLeft.canBeCapture) .Concat(forwardRight.canBeCapture) .Concat(backwardLeft.canBeCapture) .Concat(backwardRight.canBeCapture) .ToList(); localCellIdsListBYType.canBeDreggedTo = localCellIdsListBYType.canBeDreggedTo .Concat(forward.canBeDreggedTo) .Concat(backward.canBeDreggedTo) .Concat(right.canBeDreggedTo) .Concat(left.canBeDreggedTo) .Concat(forwardLeft.canBeDreggedTo) .Concat(forwardRight.canBeDreggedTo) .Concat(backwardLeft.canBeDreggedTo) .Concat(backwardRight.canBeDreggedTo) .ToList(); if (FirsMove) { CellMarkupStructure castleLeft = GetLeftCastleCellsId(cellIdsList, index); CellMarkupStructure castleRight = GetRightCastleCellsId(cellIdsList, index); localCellIdsListBYType.canBeCastle = localCellIdsListBYType.canBeCastle .Concat(castleLeft.canBeCastle) .Concat(castleRight.canBeCastle) .ToList(); } } return(localCellIdsListBYType); }
public BoardCellStruct(BoardCellId cellId, BoardCellType cellType) { CellId = cellId; CellType = cellType; Figure = null; }
public BoardCellStruct(BoardCellId cellId, BoardCellType cellType, FigureStructure figure) { CellId = cellId; CellType = cellType; Figure = figure; }
public TurnChange(BoardCellId fromCellWithId, BoardCellId toCellWithId, float turnTimeSpawn = 10f) { FromCellWithId = fromCellWithId; ToCellWithId = toCellWithId; TurnTimeSpawn = turnTimeSpawn; }
private BoardCell GetBoardCellByIndex(BoardCellId boardCellId) { int index = BoardCellsList.FindIndex(cell => cell.CellId == boardCellId); return(BoardCellsList[index]); }