This commit is contained in:
aminecmi 2015-02-08 09:04:20 +01:00
parent 09fb1e7aa4
commit ecd5504100
3 changed files with 9 additions and 5 deletions

View File

@ -35,7 +35,7 @@ public class ComportementActionChangerCouleurCase implements ComportementAction
CaseColore caseColore = (CaseColore) p.getCaseCourante(); CaseColore caseColore = (CaseColore) p.getCaseCourante();
caseColore.setOccupant(null); caseColore.setOccupant(null);
CaseColore dest = (CaseColore) cases.get(item); CaseColore dest = cases.get(item);
dest.setOccupant(p); dest.setOccupant(p);
p.setCaseCourante(dest); p.setCaseCourante(dest);

View File

@ -9,6 +9,7 @@ import java.util.ArrayList;
import java.util.Random; import java.util.Random;
public class ComportementActionSeDeplacer implements ComportementAction { public class ComportementActionSeDeplacer implements ComportementAction {
CaseAbstraite destination;
@Override @Override
public void executerAction(Personnage perso, Tuple<ArrayList<Personnage>, ArrayList<ObjetAbstrait>, ArrayList<CaseAbstraite>> t) { public void executerAction(Personnage perso, Tuple<ArrayList<Personnage>, ArrayList<ObjetAbstrait>, ArrayList<CaseAbstraite>> t) {
@ -24,13 +25,13 @@ public class ComportementActionSeDeplacer implements ComportementAction {
int item = new Random().nextInt(size); int item = new Random().nextInt(size);
destination = cases.get(item); destination = cases.get(item);
} else { } else {
recupererObjets(objs, destination, perso); recupererObjets(objs, perso);
} }
destination.setOccupant(perso); destination.setOccupant(perso);
perso.setCaseCourante(destination); perso.setCaseCourante(destination);
} }
private void recupererObjets(ArrayList<ObjetAbstrait> objs, CaseAbstraite destination, Personnage perso) { private void recupererObjets(ArrayList<ObjetAbstrait> objs, Personnage perso) {
int size = objs.size(); int size = objs.size();
int item = new Random().nextInt(size); int item = new Random().nextInt(size);
destination = objs.get(item).getCaseCourante(); destination = objs.get(item).getCaseCourante();

View File

@ -58,7 +58,10 @@ public class SimulationJeu {
// bloquer le tour jusqu'a toucher une touche du clavier. // bloquer le tour jusqu'a toucher une touche du clavier.
Scanner s = new Scanner(System.in); Scanner s = new Scanner(System.in);
s.nextLine(); String choix = s.nextLine();
if (choix == "s") {
continuer = false;
}
} }
} }