Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public bool checkDirections(Location currentlyOn, Location l)
- {
- bool valid = true;
- int lineDirection = CheckForLines(currentlyOn, l);
- if ((currentlyOn.row == l.row && l.column == currentlyOn.column + 1 && direction != (int)Direction.LEFT ) || lineDirection == 1)
- {
- direction = (int)Direction.RIGHT;
- }
- else if ((currentlyOn.row == l.row && l.column == currentlyOn.column - 1 && direction != (int)Direction.RIGHT) || lineDirection == 2)
- {
- direction = (int)Direction.LEFT;
- }
- else if ((currentlyOn.column == l.column && l.row == currentlyOn.row - 1 && direction != (int)Direction.DOWN) || lineDirection == 3)
- {
- direction = (int)Direction.UP;
- }
- else if ((currentlyOn.column == l.column && l.row == currentlyOn.row + 1 && direction != (int)Direction.UP) || lineDirection == 4)
- {
- direction = (int)Direction.DOWN;
- }
- else {
- valid = false;
- }
- return valid;
- }
Advertisement
Add Comment
Please, Sign In to add comment