Skip to content
Snippets Groups Projects
Commit 7257ba96 authored by melizzzz's avatar melizzzz
Browse files

ajout de la fonction getPriority() dans Entity pour gérer l'affichage des entités

parent 2037c055
No related branches found
No related tags found
No related merge requests found
Pipeline #39646 failed
...@@ -13,6 +13,7 @@ public class Cloud implements Entity{ ...@@ -13,6 +13,7 @@ public class Cloud implements Entity{
private int age; private int age;
private Position position; private Position position;
private final Color viewColor = Color.GREEN; private final Color viewColor = Color.GREEN;
private final int priority = 3;
...@@ -94,4 +95,8 @@ public class Cloud implements Entity{ ...@@ -94,4 +95,8 @@ public class Cloud implements Entity{
public Color getViewColor() { public Color getViewColor() {
return this.viewColor; return this.viewColor;
} }
@Override
public int getPriority(){ return this.priority;}
} }
...@@ -24,4 +24,5 @@ public interface Entity { ...@@ -24,4 +24,5 @@ public interface Entity {
public void setAge(int age); public void setAge(int age);
public void incrementAge(); public void incrementAge();
public Color getViewColor(); public Color getViewColor();
public int getPriority();
} }
...@@ -13,6 +13,7 @@ public class Fire implements Entity { ...@@ -13,6 +13,7 @@ public class Fire implements Entity {
private Position position; private Position position;
private final Color viewColor = Color.RED; private final Color viewColor = Color.RED;
private int age; private int age;
private final int priority = 0;
public Fire(Position position, Board<Square> b) { public Fire(Position position, Board<Square> b) {
this.b = b; this.b = b;
...@@ -73,4 +74,7 @@ public class Fire implements Entity { ...@@ -73,4 +74,7 @@ public class Fire implements Entity {
public void setAge(int age) { public void setAge(int age) {
this.age = age; this.age = age;
} }
@Override
public int getPriority(){ return this.priority;}
} }
...@@ -12,6 +12,7 @@ public class FireFighter implements Entity { ...@@ -12,6 +12,7 @@ public class FireFighter implements Entity {
private int age; private int age;
private Position position; private Position position;
private final Color viewColor = Color.BLUE; private final Color viewColor = Color.BLUE;
private final int priority = 1;
public FireFighter(Position position, Board<Square> b) { public FireFighter(Position position, Board<Square> b) {
this.position = position; this.position = position;
...@@ -138,4 +139,6 @@ public class FireFighter implements Entity { ...@@ -138,4 +139,6 @@ public class FireFighter implements Entity {
public void setAge(int age) { public void setAge(int age) {
this.age = age; this.age = age;
} }
public int getPriority(){ return this.priority;}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment