Пример #1
0
 @Override
 public boolean validMoveTo(Square toSquare) {
   if (toSquare.getClass() == RoomSquare.class) {
     return hasDoor; // if room square, can only move there if there is a door here
   } else { // check if square is a valid destination otherwise
     return toSquare.validDestinationSquare(this);
   }
 }