public void recordMove(int posXtoMove, int posYtoMove) { MoveRecord moveRecord = new MoveRecord(gameManager.cureentSelect.posX, gameManager.cureentSelect.posY, posXtoMove, posYtoMove, boardScript.chessBoardString[gameManager.cureentSelect.posX, gameManager.cureentSelect.posY], boardScript.chessBoardString[posXtoMove, posYtoMove], gameManager.cureentSelect.firstMove); moveRecordList.Add(moveRecord); //moveRecordList.Add(new MoveRecord(gameManager.cureentSelect.posX, gameManager.cureentSelect.posY,posXtoMove, posYtoMove, // chessBoardString[gameManager.cureentSelect.posX,gameManager.cureentSelect.posY],chessBoardString[posXtoMove,posYtoMove], gameManager.cureentSelect.firstMove)); }
public static void undoMove(BoardScript boardScript, GameManager gameManager) { MoveRecord moveRecord = boardScript.moveRecorder.getLastRecord(); //moveFigueOnBoard gameManager.cureentSelect = gameManager.getFigureOnPosition(moveRecord.toX, moveRecord.toY); MoveFigure(moveRecord.fromX, moveRecord.fromY, boardScript, gameManager); gameManager.cureentSelect.firstMove = moveRecord.firstMove; //CreateFigureIfBeaten if (moveRecord.moveTo != " ") { boardScript.chessBoardString[moveRecord.toX, moveRecord.toY] = moveRecord.moveTo; boardScript.figurePlacer.figreSet(moveRecord.toX, moveRecord.toY, moveRecord.firstMove, boardScript.chessBoardString); } boardScript.moveRecorder.deleteLastRecord(); }
public void UpdateMoveTracker(MoveRecord moveRecord) { MoveToTile.transform.position = new Vector3(moveRecord.toX, moveRecord.toY); MoveFromTile.transform.position = new Vector3(moveRecord.fromX, moveRecord.fromY); }