예제 #1
0
    public ChessPieceGUI GetGUIPiece(ChessPiece forPiece)
    {
        ChessPieceGUI gui = pieces.Find((ChessPieceGUI cpg) =>
        {
            return(cpg.chessPiece != null && Object.ReferenceEquals(cpg.chessPiece, forPiece));
        }
                                        );

        return(gui);
    }
예제 #2
0
 public void ResetBoardGUI()
 {
     // UNITTEST ?
     pieces.ForEach((ChessPieceGUI cpg) =>
     {
         cpg.gameObject.GetComponent <Renderer>().enabled = false;
         Destroy(cpg.gameObject);
     }
                    );
     pieces.Clear();
     for (int x = 0; x < board.width; x++)
     {
         for (int y = 0; y < board.height; y++)
         {
             ChessPiece currPiece = board.GetChessPieceAt(x, y);
             if (currPiece != null)
             {
                 ChessPieceGUI newGUIElement = GetChessPieceGUIObject(currPiece).GetComponent <ChessPieceGUI>();
                 pieces.Add(newGUIElement);
             }
         }
     }
 }