Add AbstractBox and lock case notion (to see if it is viable to keep it)
This commit is contained in:
parent
c6f4dbffe3
commit
5201e73772
@ -101,9 +101,7 @@ public class GUI {
|
||||
List<Player> players = Arrays.asList(new RandomComputerPlayer(1, null, ClassPlayer.DEFAULT),
|
||||
new RandomComputerPlayer(2, null, ClassPlayer.DEFAULT));
|
||||
Grid grid = new Grid(16, 16, players);
|
||||
grid.placePlayersBRUT();
|
||||
grid.placeEnergyBallBRUT();
|
||||
grid.placeInternWallBRUT();
|
||||
//grid.placePlayersBRUT();
|
||||
return grid;
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,21 @@
|
||||
package fr.lnl.game.server.games.grid;
|
||||
|
||||
public class AbstractBox implements Box{
|
||||
|
||||
boolean lock;
|
||||
|
||||
public AbstractBox(){
|
||||
lock = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLock(boolean lock) {
|
||||
this.lock = lock;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLock() {
|
||||
return lock;
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,7 @@
|
||||
package fr.lnl.game.server.games.grid;
|
||||
|
||||
public interface Box {
|
||||
|
||||
boolean isLock();
|
||||
void setLock(boolean lock);
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ package fr.lnl.game.server.games.grid;
|
||||
import fr.lnl.game.server.games.player.Player;
|
||||
import fr.lnl.game.server.utils.Point;
|
||||
|
||||
public class EnergyBall implements Box, InteractiveBox {
|
||||
public class EnergyBall extends AbstractBox implements InteractiveBox{
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
|
@ -3,7 +3,7 @@ package fr.lnl.game.server.games.grid;
|
||||
import fr.lnl.game.server.games.player.Player;
|
||||
import fr.lnl.game.server.utils.Point;
|
||||
|
||||
public abstract class Explosive implements Box, InteractiveBox {
|
||||
public abstract class Explosive extends AbstractBox implements InteractiveBox {
|
||||
|
||||
@Override
|
||||
public void interact(Grid grid, Player player, Point position) {
|
||||
|
@ -4,7 +4,7 @@ import fr.lnl.game.server.utils.Cardinal;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class Wall implements Box {
|
||||
public class Wall extends AbstractBox {
|
||||
|
||||
private final Cardinal cardinal;
|
||||
private final int x;
|
||||
|
Loading…
Reference in New Issue
Block a user