private void Start() { gameMoves = PGNLoader.MovesFromPGN(pgn); board = new Board(); board.LoadStartPosition(); boardUI = FindObjectOfType <BoardUI>(); boardUI.UpdatePosition(board); }
private void Start() { moves = new Stack <Move>(); arrowObjects = new List <GameObject>(); board = new Board(); var sw = Stopwatch.StartNew(); book = BookCreator.LoadBookFromFile(bookFile); Debug.Log("Book loaded: " + sw.ElapsedMilliseconds + " ms."); board.LoadStartPosition(); boardUI = FindObjectOfType <BoardUI>(); boardUI.UpdatePosition(board); player = new HumanPlayer(board); player.onMoveChosen += OnMoveChosen; player.NotifyTurnToMove(); DrawBookMoves(); }
void Update() { if (Input.GetKeyDown(KeyCode.U)) { if (moves.Count > 0) { var move = moves.Pop(); board.UnmakeMove(move); if (moves.Count > 0) { boardUI.OnMoveMade(board, moves.Peek()); } else { boardUI.UpdatePosition(board); boardUI.ResetSquareColours(false); } } } DrawBookMoves(); player.Update(); }