Beispiel #1
0
 private void Start()
 {
     gameMoves = PGNLoader.MovesFromPGN(pgn);
     board     = new Board();
     board.LoadStartPosition();
     boardUI = FindObjectOfType <BoardUI>();
     boardUI.UpdatePosition(board);
 }
Beispiel #2
0
        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();
        }
Beispiel #3
0
 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();
 }