2021-03-28 14:35:10 +02:00
|
|
|
package battleship.model;
|
|
|
|
|
|
|
|
import battleship.utils.Pair;
|
2021-04-29 19:34:13 +02:00
|
|
|
|
2021-04-29 11:41:43 +02:00
|
|
|
import java.awt.event.KeyEvent;
|
2021-03-28 14:35:10 +02:00
|
|
|
|
|
|
|
public enum Direction {
|
|
|
|
|
2021-04-29 11:41:43 +02:00
|
|
|
RIGHT(new Pair<>(0, 1), "D", KeyEvent.VK_RIGHT),
|
|
|
|
LEFT(new Pair<>(0,-1), "G", KeyEvent.VK_LEFT),
|
|
|
|
UP(new Pair<>(-1,0), "H", KeyEvent.VK_UP),
|
|
|
|
DOWN(new Pair<>(1,0), "B", KeyEvent.VK_DOWN),
|
|
|
|
DEFAULT(new Pair<>(-1,-1), null, KeyEvent.VK_UNDEFINED);
|
2021-03-28 14:35:10 +02:00
|
|
|
|
|
|
|
private final Pair<Integer, Integer> direction;
|
|
|
|
private final String keyword;
|
2021-04-29 11:41:43 +02:00
|
|
|
private final int arrow;
|
2021-03-28 14:35:10 +02:00
|
|
|
|
2021-04-29 11:41:43 +02:00
|
|
|
<K, U> Direction(Pair<Integer, Integer> ukPair, String keyword, int arrow) {
|
2021-03-28 14:35:10 +02:00
|
|
|
this.direction = ukPair;
|
|
|
|
this.keyword = keyword;
|
2021-04-29 11:41:43 +02:00
|
|
|
this.arrow = arrow;
|
2021-03-28 14:35:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public Pair<Integer, Integer> getDirection() {
|
|
|
|
return direction;
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getKeyword() {
|
|
|
|
return keyword;
|
|
|
|
}
|
2021-04-29 11:41:43 +02:00
|
|
|
|
|
|
|
public int getArrow() {
|
|
|
|
return arrow;
|
|
|
|
}
|
2021-03-28 14:35:10 +02:00
|
|
|
}
|