mirror of
https://github.com/guezoloic/racing-game.git
synced 2026-03-28 18:03:50 +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
|
* cases qui composent le circuit de
|
||||||
* course.
|
* course.
|
||||||
*/
|
*/
|
||||||
public enum CircuitCell implements Circuit {
|
public enum CircuitCell {
|
||||||
/**
|
/**
|
||||||
* Case hors piste, non
|
* Case hors piste, non
|
||||||
* praticable par les
|
* praticable par les
|
||||||
@@ -36,9 +36,4 @@ public enum CircuitCell implements Circuit {
|
|||||||
* livrable 2
|
* livrable 2
|
||||||
*/
|
*/
|
||||||
YROAD;
|
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
|
public class Map
|
||||||
{
|
{
|
||||||
private Circuit[][] map;
|
private CircuitCell[][] map;
|
||||||
private ArrayList<Point> pathMap;
|
private ArrayList<Point> pathMap;
|
||||||
|
|
||||||
public Map(Circuit[][] map)
|
private Map(CircuitCell[][] map)
|
||||||
{
|
{
|
||||||
this.map = map;
|
this.map = map;
|
||||||
boolean isPossible = this.buildPath();
|
boolean isPossible = this.buildPath();
|
||||||
@@ -41,7 +41,7 @@ public class Map
|
|||||||
{
|
{
|
||||||
for (int j = 0; j < map.length; j++)
|
for (int j = 0; j < map.length; j++)
|
||||||
{
|
{
|
||||||
switch (map[i][j].getType())
|
switch (map[i][j])
|
||||||
{
|
{
|
||||||
case CircuitCell.START:
|
case CircuitCell.START:
|
||||||
if (start == null) start = new Point(j, i);
|
if (start == null) start = new Point(j, i);
|
||||||
@@ -100,7 +100,7 @@ public class Map
|
|||||||
if (next.equals(previous))
|
if (next.equals(previous))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
CircuitCell type = map[y][x].getType();
|
CircuitCell type = map[y][x];
|
||||||
if ((type == CircuitCell.ROAD || type == CircuitCell.YROAD) ||
|
if ((type == CircuitCell.ROAD || type == CircuitCell.YROAD) ||
|
||||||
(type == CircuitCell.FINISH && map[current.y][current.x] == CircuitCell.ROAD))
|
(type == CircuitCell.FINISH && map[current.y][current.x] == CircuitCell.ROAD))
|
||||||
{
|
{
|
||||||
@@ -119,7 +119,7 @@ public class Map
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Circuit getElement(int x, int y)
|
public CircuitCell getElement(int x, int y)
|
||||||
{
|
{
|
||||||
return map[y][x];
|
return map[y][x];
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user