Add AbstractBox and lock case notion (to see if it is viable to keep it)

This commit is contained in:
Katchan 2021-12-02 20:01:49 +01:00
parent c6f4dbffe3
commit 5201e73772
6 changed files with 28 additions and 6 deletions

View File

@ -101,9 +101,7 @@ public class GUI {
List<Player> players = Arrays.asList(new RandomComputerPlayer(1, null, ClassPlayer.DEFAULT), List<Player> players = Arrays.asList(new RandomComputerPlayer(1, null, ClassPlayer.DEFAULT),
new RandomComputerPlayer(2, null, ClassPlayer.DEFAULT)); new RandomComputerPlayer(2, null, ClassPlayer.DEFAULT));
Grid grid = new Grid(16, 16, players); Grid grid = new Grid(16, 16, players);
grid.placePlayersBRUT(); //grid.placePlayersBRUT();
grid.placeEnergyBallBRUT();
grid.placeInternWallBRUT();
return grid; return grid;
} }

View File

@ -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;
}
}

View File

@ -1,4 +1,7 @@
package fr.lnl.game.server.games.grid; package fr.lnl.game.server.games.grid;
public interface Box { public interface Box {
boolean isLock();
void setLock(boolean lock);
} }

View File

@ -3,7 +3,7 @@ package fr.lnl.game.server.games.grid;
import fr.lnl.game.server.games.player.Player; import fr.lnl.game.server.games.player.Player;
import fr.lnl.game.server.utils.Point; import fr.lnl.game.server.utils.Point;
public class EnergyBall implements Box, InteractiveBox { public class EnergyBall extends AbstractBox implements InteractiveBox{
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {

View File

@ -3,7 +3,7 @@ package fr.lnl.game.server.games.grid;
import fr.lnl.game.server.games.player.Player; import fr.lnl.game.server.games.player.Player;
import fr.lnl.game.server.utils.Point; import fr.lnl.game.server.utils.Point;
public abstract class Explosive implements Box, InteractiveBox { public abstract class Explosive extends AbstractBox implements InteractiveBox {
@Override @Override
public void interact(Grid grid, Player player, Point position) { public void interact(Grid grid, Player player, Point position) {

View File

@ -4,7 +4,7 @@ import fr.lnl.game.server.utils.Cardinal;
import java.util.Objects; import java.util.Objects;
public class Wall implements Box { public class Wall extends AbstractBox {
private final Cardinal cardinal; private final Cardinal cardinal;
private final int x; private final int x;