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.setOccupant(null);
CaseColore dest = (CaseColore) cases.get(item);
CaseColore dest = cases.get(item);
dest.setOccupant(p);
p.setCaseCourante(dest);

View File

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

View File

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