package labyrinthe; import java.util.ArrayList; import java.util.List; import javafx.util.Pair; public class Salle { private Pair coordonnees; private boolean sortie; private List listePorte= new ArrayList(); private List listeEnnemie= new ArrayList(); //indice de monstre public Salle(int x, int y, boolean out) { this.listeEnnemie=new ArrayList(); this.coordonnees=new Pair(x,y); this.sortie=out; } public Salle(int positionX, int positionY, boolean sortie, List listeEnnemie) { this.coordonnees=new Pair(positionX,positionY); this.sortie = sortie; this.listeEnnemie = listeEnnemie; } public String getType(){ return "salle"; } public Pair getCoordonnes() { return this.coordonnees; } public boolean estSortie() { return sortie; } public List getListePorte() { return this.listePorte; } public List getListeEnnemie() { return listeEnnemie; } public boolean equals(Object o) { return (this.coordonnees.getKey()==((Salle)o).getCoordonnes().getKey() && this.coordonnees.getValue() ==((Salle)o).getCoordonnes().getValue()); } public void cle(Labyrinthe lab) { for (int i : listePorte ) lab.listePorte.get(i).ouverture(); } public boolean estVide() { return (listeEnnemie.size()==0); } public Salle findNextSalle(Pair coordonnes,Labyrinthe lab) { for (int porte : listePorte) { if (lab.listePorte.get(porte).prochainSaut(this).coordonnees.equals(coordonnes)) return lab.listePorte.get(porte).prochainSaut(this); } return null; } }