Added lots'a init stuff in Game

This commit is contained in:
Bokros Bálint 2016-05-07 14:04:42 +02:00
parent 96e53324e1
commit e1c6612356

View File

@ -1,16 +1,40 @@
package cicaprojekt; package cicaprojekt;
import java.io.File;
import java.io.IOException;
import java.util.Map;
import java.util.Random;
public class Game { public class Game {
private Player oneill; private Player oneill;
private Player jaffa;
private PlayerBase replicator;
private Dungeon dungeon; private Dungeon dungeon;
private Random random;
private FlowOfTime flowoftime; private FlowOfTime flowoftime;
public Game() {
dungeon = new Dungeon();
random = new Random();
}
public void allZPMsCollected() { public void allZPMsCollected() {
this.stopGame(); this.stopGame();
} }
public void startGame() { public void startGame(File dungeonFile) throws IOException {
Stargate.init();
Map<String, Tile> players = dungeon.buildDungeon(dungeonFile);
oneill = new Player("O'Neill", players.get("oneill"), getRandomDirection());
jaffa = new Player("Jaffa", players.get("jaffa"), getRandomDirection());
replicator = new PlayerBase("Replicator", players.get("replicator"), getRandomDirection());
}
private Direction getRandomDirection() {
return Direction.values()[random.nextInt(Direction.values().length)];
} }
public void stopGame() { public void stopGame() {