mirror of
https://github.com/guezoloic/L3-racing-game.git
synced 2026-03-28 19:13:41 +00:00
feat: enlever Circuit.java et toute ses impl
This commit is contained in:
@@ -1,3 +0,0 @@
|
||||
public interface Circuit {
|
||||
CircuitCell getType();
|
||||
}
|
||||
@@ -4,7 +4,7 @@
|
||||
* cases qui composent le circuit de
|
||||
* course.
|
||||
*/
|
||||
public enum CircuitCell implements Circuit {
|
||||
public enum CircuitCell {
|
||||
/**
|
||||
* Case hors piste, non
|
||||
* praticable par les
|
||||
@@ -36,9 +36,4 @@ public enum CircuitCell implements Circuit {
|
||||
* livrable 2
|
||||
*/
|
||||
YROAD;
|
||||
|
||||
@Override
|
||||
public CircuitCell getType() {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
10
src/Map.java
10
src/Map.java
@@ -3,10 +3,10 @@ import java.util.ArrayList;
|
||||
|
||||
public class Map
|
||||
{
|
||||
private Circuit[][] map;
|
||||
private CircuitCell[][] map;
|
||||
private ArrayList<Point> pathMap;
|
||||
|
||||
public Map(Circuit[][] map)
|
||||
private Map(CircuitCell[][] map)
|
||||
{
|
||||
this.map = map;
|
||||
boolean isPossible = this.buildPath();
|
||||
@@ -41,7 +41,7 @@ public class Map
|
||||
{
|
||||
for (int j = 0; j < map.length; j++)
|
||||
{
|
||||
switch (map[i][j].getType())
|
||||
switch (map[i][j])
|
||||
{
|
||||
case CircuitCell.START:
|
||||
if (start == null) start = new Point(j, i);
|
||||
@@ -100,7 +100,7 @@ public class Map
|
||||
if (next.equals(previous))
|
||||
continue;
|
||||
|
||||
CircuitCell type = map[y][x].getType();
|
||||
CircuitCell type = map[y][x];
|
||||
if ((type == CircuitCell.ROAD || type == CircuitCell.YROAD) ||
|
||||
(type == CircuitCell.FINISH && map[current.y][current.x] == CircuitCell.ROAD))
|
||||
{
|
||||
@@ -119,7 +119,7 @@ public class Map
|
||||
return false;
|
||||
}
|
||||
|
||||
public Circuit getElement(int x, int y)
|
||||
public CircuitCell getElement(int x, int y)
|
||||
{
|
||||
return map[y][x];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user