コード例 #1
0
ファイル: ChessGameHandler.cs プロジェクト: miko-t/ChessAI
    private void Update()
    {
        if (Input.GetKeyDown(KeyCode.I))
        {
            Debug.Log("show every possible move!");
            board.RefreshBoard();
            for (int x = 0; x < 8; x++)
            {
                for (int y = 0; y < 8; y++)
                {
                    var c = new Color(Random.value, Random.value, Random.value, 1);
                    c.a = 1f;
                    var tile = board.tiles[x, y];
                    var xy   = x * y / 64f;

                    tile.DrawAllMoves(board.CurrentTurn());
                }
            }
        }
        if (next != null)
        {
            Debug.Log("Player " + board.CurrentTurn() + " has made a move in : " + (Time.timeSinceLevelLoad - time) * 1000 + " ms");
            board.SwitchBoard(next);
            next = null;
        }
    }
コード例 #2
0
 public void EnableMoves(PlayerColor player)
 {
     if (move != null)
     {
         drawer.SwitchBoard(move.GetNextBoard());
         //drawer.RefreshBoard ();
         return;
     }
     drawer.RefreshBoard();
     ColorTile(Color.cyan, true);
     if (player == drawer.CurrentTurn() && node.piece != null && node.piece.color == player)
     {
         List <PieceMove> moves = node.piece.GetValidMoves();
         //List<PieceMove> moves = node.piece.GetMoves ();
         foreach (var move in moves)
         {
             //cord.GetTileHandler (drawer).SetFocus (true);
             move.end.GetTileHandler(drawer).EnableMove(move);
         }
     }
 }