mirror of
https://github.com/inf112-v20/Fiasko.git
synced 2025-06-27 11:44:42 +02:00
Gjør det mulig å sjekke om to retninger står rett på hverandre
This commit is contained in:
@ -45,6 +45,17 @@ public enum Direction {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether two directions are perpendicular
|
||||
* @param direction1 The first direction
|
||||
* @param direction2 The second direction
|
||||
* @return True if the directions are perpendicular
|
||||
*/
|
||||
public static boolean arePerpendicular(Direction direction1, Direction direction2) {
|
||||
return direction1.equals(getLeftRotatedDirection(direction2)) ||
|
||||
direction1.equals(getRightRotatedDirection(direction2));
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the reverse of a direction
|
||||
* @param direction A direction
|
||||
|
Reference in New Issue
Block a user