2015-01-07 09:41:16 +00:00
|
|
|
import Cases.CaseAbstraite;
|
2014-12-03 08:13:23 +00:00
|
|
|
import Fabriques.Scenario.FabriqueScenarioAbstraite;
|
2015-02-07 10:35:29 +00:00
|
|
|
import Observateur.Arbitre;
|
2014-12-03 08:13:23 +00:00
|
|
|
import Person.Personnage;
|
2015-01-27 17:14:56 +00:00
|
|
|
import utils.InterfaceConsole;
|
2014-10-03 13:34:03 +00:00
|
|
|
|
|
|
|
import java.util.ArrayList;
|
2015-01-07 09:41:16 +00:00
|
|
|
import java.util.Scanner;
|
2014-10-03 13:34:03 +00:00
|
|
|
|
2015-01-20 18:16:30 +00:00
|
|
|
|
2014-10-03 13:34:03 +00:00
|
|
|
public class SimulationJeu {
|
2015-01-07 09:41:16 +00:00
|
|
|
ArrayList<Personnage> personnages;
|
|
|
|
CaseAbstraite[][] plateau;
|
2014-12-03 08:13:23 +00:00
|
|
|
FabriqueScenarioAbstraite f;
|
2015-01-27 17:14:56 +00:00
|
|
|
InterfaceConsole intefaceC;
|
2015-02-07 10:35:29 +00:00
|
|
|
Arbitre a;
|
2015-01-20 18:16:30 +00:00
|
|
|
|
2014-12-03 08:13:23 +00:00
|
|
|
public SimulationJeu(FabriqueScenarioAbstraite fb) {
|
|
|
|
f = fb;
|
2015-01-07 09:41:16 +00:00
|
|
|
personnages = new ArrayList<Personnage>();
|
|
|
|
plateau = f.CreerPlateau();
|
|
|
|
|
2015-02-07 10:35:29 +00:00
|
|
|
personnages = f.CreerPersonnages(plateau);
|
2015-01-07 09:41:16 +00:00
|
|
|
|
2015-02-01 14:27:28 +00:00
|
|
|
f.creerObjets(plateau);
|
|
|
|
|
2015-01-27 17:14:56 +00:00
|
|
|
intefaceC = new InterfaceConsole(plateau);
|
|
|
|
|
2015-02-07 10:35:29 +00:00
|
|
|
a = new Arbitre();
|
2014-10-03 13:34:03 +00:00
|
|
|
}
|
|
|
|
|
2015-01-07 09:41:16 +00:00
|
|
|
public void afficheTous() {
|
2015-02-01 12:18:11 +00:00
|
|
|
System.out.println("");
|
2015-01-27 17:14:56 +00:00
|
|
|
intefaceC.afficherPlateau();
|
2014-10-03 13:34:03 +00:00
|
|
|
}
|
|
|
|
|
2015-02-01 10:50:15 +00:00
|
|
|
public void recupererInformations() {
|
2015-01-31 10:03:59 +00:00
|
|
|
for (Personnage p : personnages) {
|
2014-10-03 13:34:03 +00:00
|
|
|
|
2015-02-01 10:50:15 +00:00
|
|
|
}
|
2014-10-03 13:34:03 +00:00
|
|
|
}
|
|
|
|
|
2015-01-07 09:41:16 +00:00
|
|
|
public void lancerJeu() {
|
2015-02-07 10:35:29 +00:00
|
|
|
for (Personnage p : personnages) {
|
|
|
|
a.attach(p);
|
|
|
|
}
|
2015-01-07 09:41:16 +00:00
|
|
|
|
|
|
|
boolean continuer = true;
|
2015-02-01 10:50:15 +00:00
|
|
|
afficheTous();
|
2015-01-07 09:41:16 +00:00
|
|
|
while (continuer) {
|
2015-02-07 10:35:29 +00:00
|
|
|
a.update();
|
2015-01-07 09:41:16 +00:00
|
|
|
for (Personnage p : personnages) {
|
2015-02-01 12:18:11 +00:00
|
|
|
p.Execution(p.AnalyseSituation());
|
2015-01-07 09:41:16 +00:00
|
|
|
recupererInformations();
|
|
|
|
}
|
2015-02-01 13:37:33 +00:00
|
|
|
f.tourParTour(plateau);
|
2015-02-01 10:50:15 +00:00
|
|
|
afficheTous();
|
2015-02-01 13:37:33 +00:00
|
|
|
|
2015-01-07 09:41:16 +00:00
|
|
|
// bloquer le tour jusqu'a toucher une touche du clavier.
|
|
|
|
Scanner s = new Scanner(System.in);
|
|
|
|
s.nextLine();
|
2014-10-03 13:34:03 +00:00
|
|
|
}
|
2015-01-07 09:41:16 +00:00
|
|
|
|
2014-10-03 13:34:03 +00:00
|
|
|
}
|
|
|
|
}
|