41 lines
879 B
Java
41 lines
879 B
Java
import java.awt.*;
|
|
import java.util.List;
|
|
|
|
public abstract class Player {
|
|
protected boolean myTurn;
|
|
protected boolean isServer;
|
|
protected boolean waitingForResponse;
|
|
protected Player enemy;
|
|
protected String name;
|
|
protected Board board;
|
|
|
|
public Player(int size) {
|
|
this.board = new Board(size);
|
|
}
|
|
|
|
public void receiveShoot(Point point) {
|
|
HitResponse hitResponse = board.getHitResponsOnPoint(point);
|
|
if (!(hitResponse == null)){
|
|
enemy.receiveHit(hitResponse);
|
|
} else {
|
|
enemy.receiveHit(this.board.hit(point));
|
|
}
|
|
}
|
|
|
|
public void receiveHit(HitResponse hitResponse) {
|
|
enemy.board.addHits(hitResponse);
|
|
}
|
|
|
|
public void click(Point point) {
|
|
|
|
}
|
|
|
|
public void beginTrun() {
|
|
|
|
}
|
|
|
|
public void setEnemy(Player enemy) {
|
|
this.enemy = enemy;
|
|
}
|
|
}
|