Esempio n. 1
0
        // Tests potential destinations for complex pieces (Rook, Bishop, Queen)
        private void testComplexCandidacy(Tile currentTile, Piece debatedPiece)
        {
            int x = currentTile.x, y = currentTile.y;

            foreach (Tuple <int, int> coordinate in debatedPiece.getListOfGeneralMoves()) //More complex moving pieces
            {
                bool foundFirstCollision = false;
                int  newX = x + coordinate.Item1, newY = y + coordinate.Item2;
                while (!foundFirstCollision)
                {
                    if (gameManager.boardManager.testPotentialComplexDestination(debatedPiece, newX, newY) == 1)
                    {
                        drawPotentialDestinations(newX, newY, currentTile);
                        newX += coordinate.Item1;
                        newY += coordinate.Item2;
                    }
                    else if (gameManager.boardManager.testPotentialComplexDestination(debatedPiece, newX, newY) == 0)
                    {
                        drawPotentialDestinations(newX, newY, currentTile);
                        foundFirstCollision = true;
                    }
                    else
                    {
                        foundFirstCollision = true;
                    }
                }
            }
        }
Esempio n. 2
0
 // Tests potential destinations for simple pieces (i.e. Pawn, King, Knight)
 private void testSimplexCandidacy(Tile currentTile, Piece debatedPiece)
 {
     foreach (Tuple <int, int> coordinate in debatedPiece.getListOfGeneralMoves())
     {
         int newX = currentTile.x + coordinate.Item1, newY = currentTile.y + coordinate.Item2;
         if (debatedPiece.toText() == 'P')
         {
             if (gameManager.boardManager.testPotentialPawnDestination(currentTile, newX, newY))
             {
                 drawPotentialDestinations(newX, newY, currentTile);
             }
         }
         else
         if (gameManager.boardManager.testPotentialSimplexDestination(debatedPiece, newX, newY))
         {
             drawPotentialDestinations(newX, newY, currentTile);
         }
     }
 }