Refactored extends and implements
This commit is contained in:
parent
559c590b52
commit
f5b26810b8
12
server/src/main/java/fr/lnl/game/server/ServerMain.java
Normal file
12
server/src/main/java/fr/lnl/game/server/ServerMain.java
Normal file
@ -0,0 +1,12 @@
|
||||
package fr.lnl.game.server;
|
||||
|
||||
import fr.lnl.game.server.games.grid.Grid;
|
||||
|
||||
public class ServerMain {
|
||||
|
||||
public static void main(String[] args) {
|
||||
Grid grid = new Grid(10,10);
|
||||
grid.initGrid();
|
||||
grid.printGrid();
|
||||
}
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
package fr.lnl.game.server.games.action;
|
||||
|
||||
public abstract class AbstractAction implements Action {
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
package fr.lnl.game.server.games.action;
|
||||
|
||||
public class DeployShield implements Action{
|
||||
public class DeployShield extends AbstractAction {
|
||||
@Override
|
||||
public void doAction() {
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
package fr.lnl.game.server.games.action;
|
||||
|
||||
public class DropBomb extends DropObject{
|
||||
public class DropBomb extends DropObject {
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
package fr.lnl.game.server.games.action;
|
||||
|
||||
public class DropMine extends DropObject{
|
||||
public class DropMine extends DropObject {
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
package fr.lnl.game.server.games.action;
|
||||
|
||||
public class DropObject implements Action{
|
||||
public abstract class DropObject extends AbstractAction {
|
||||
@Override
|
||||
public void doAction() {
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
package fr.lnl.game.server.games.action;
|
||||
|
||||
public class Move implements Action{
|
||||
public class Move extends AbstractAction {
|
||||
@Override
|
||||
public void doAction() {
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
package fr.lnl.game.server.games.action;
|
||||
|
||||
public class Nothing implements Action {
|
||||
public class Nothing extends AbstractAction {
|
||||
@Override
|
||||
public void doAction() {
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
package fr.lnl.game.server.games.action;
|
||||
|
||||
public class Shot implements Action{
|
||||
public class Shot extends AbstractAction {
|
||||
@Override
|
||||
public void doAction() {
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
package fr.lnl.game.server.games.grid;
|
||||
|
||||
public class Explosive implements Box{
|
||||
public abstract class Explosive implements Box{
|
||||
}
|
||||
|
@ -47,6 +47,11 @@ public class Grid {
|
||||
}
|
||||
|
||||
|
||||
// TODO: 18/10/2021
|
||||
public void placePlayers() {
|
||||
|
||||
}
|
||||
|
||||
public void printGrid() {
|
||||
for (int i = 0; i < x; i++) {
|
||||
System.out.print("\n");
|
||||
@ -77,10 +82,4 @@ public class Grid {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
Grid grid = new Grid(10,10);
|
||||
grid.initGrid();
|
||||
grid.printGrid();
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ package fr.lnl.game.server.games.grid;
|
||||
|
||||
import fr.lnl.game.server.utils.Cardinal;
|
||||
|
||||
public class Wall implements Box{
|
||||
public class Wall implements Box {
|
||||
|
||||
private Cardinal cardinal;
|
||||
private int x;
|
||||
|
@ -3,7 +3,7 @@ package fr.lnl.game.server.games.player;
|
||||
import fr.lnl.game.server.games.weapon.Weapon;
|
||||
import fr.lnl.game.server.utils.Point;
|
||||
|
||||
public abstract class AbstractPlayer {
|
||||
public abstract class AbstractPlayer implements Player {
|
||||
|
||||
private int id;
|
||||
private Point position;
|
||||
|
@ -3,7 +3,8 @@ package fr.lnl.game.server.games.player;
|
||||
import fr.lnl.game.server.games.weapon.Weapon;
|
||||
import fr.lnl.game.server.utils.Point;
|
||||
|
||||
public class ComputerPlayer extends AbstractPlayer implements Player{
|
||||
public class ComputerPlayer extends AbstractPlayer{
|
||||
|
||||
public ComputerPlayer(int id, Point position, int energy, Weapon weapon, boolean shieldDeploy) {
|
||||
super(id, position, energy, weapon, shieldDeploy);
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ package fr.lnl.game.server.games.player;
|
||||
import fr.lnl.game.server.games.weapon.Weapon;
|
||||
import fr.lnl.game.server.utils.Point;
|
||||
|
||||
public class HumanPlayer extends AbstractPlayer implements Player{
|
||||
public class HumanPlayer extends AbstractPlayer {
|
||||
public HumanPlayer(int id, Point position, int energy, Weapon weapon, boolean shieldDeploy) {
|
||||
super(id, position, energy, weapon, shieldDeploy);
|
||||
}
|
||||
|
@ -1,10 +1,14 @@
|
||||
package fr.lnl.game.server.model;
|
||||
import java.util.List;
|
||||
|
||||
public abstract class AbstractModelListening implements ModelListener{
|
||||
public abstract class AbstractModelListening implements ModelListener {
|
||||
|
||||
List<ModelListener> listeners;
|
||||
|
||||
public abstract void addListener(ModelListener e);
|
||||
|
||||
public abstract void removalListener(ModelListener e);
|
||||
|
||||
public void fireChange(){
|
||||
for(ModelListener e : listeners){
|
||||
e.updateModel(this);
|
||||
|
@ -1,5 +1,12 @@
|
||||
package fr.lnl.game.server.utils;
|
||||
|
||||
public enum Cardinal {
|
||||
NORTH,SOUTH,EAST,WEST,NORTH_EAST,NORTH_WEST,SOUTH_EAST,SOUTH_WEST
|
||||
NORTH,
|
||||
SOUTH,
|
||||
EAST,
|
||||
WEST,
|
||||
NORTH_EAST,
|
||||
NORTH_WEST,
|
||||
SOUTH_EAST,
|
||||
SOUTH_WEST
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user