summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2014-10-16 15:45:16 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2014-10-16 15:45:16 +0200
commit10acc97532eec265dabb697c67185dff387fe27b (patch)
treec30f53602860e9990cb15aebf491065d4bed3268 /core
parent125708799076a89dcf4ed94326128ec787ec7ec7 (diff)
downloadRustAndDust-10acc97532eec265dabb697c67185dff387fe27b.zip
RustAndDust-10acc97532eec265dabb697c67185dff387fe27b.tar.gz
Ctrl: it is hold in TankOnTank, and recieves Config at construction
Diffstat (limited to 'core')
-rw-r--r--core/src/ch/asynk/tankontank/TankOnTank.java2
-rw-r--r--core/src/ch/asynk/tankontank/game/Ctrl.java20
2 files changed, 10 insertions, 12 deletions
diff --git a/core/src/ch/asynk/tankontank/TankOnTank.java b/core/src/ch/asynk/tankontank/TankOnTank.java
index 6d404a8..ec22fcb 100644
--- a/core/src/ch/asynk/tankontank/TankOnTank.java
+++ b/core/src/ch/asynk/tankontank/TankOnTank.java
@@ -9,12 +9,14 @@ import com.badlogic.gdx.scenes.scene2d.ui.Skin;
import ch.asynk.tankontank.screens.LoadScreen;
import ch.asynk.tankontank.game.Factory;
+import ch.asynk.tankontank.game.Ctrl;
public class TankOnTank extends Game
{
public AssetManager manager;
public Factory factory;
public Skin skin;
+ public Ctrl ctrl;
@Override
public void create ()
diff --git a/core/src/ch/asynk/tankontank/game/Ctrl.java b/core/src/ch/asynk/tankontank/game/Ctrl.java
index a3dafc9..4d8313a 100644
--- a/core/src/ch/asynk/tankontank/game/Ctrl.java
+++ b/core/src/ch/asynk/tankontank/game/Ctrl.java
@@ -15,7 +15,6 @@ public class Ctrl implements Disposable
{
private final TankOnTank game;
- private Factory factory;
public Map map;
public Hud hud;
public Config cfg;
@@ -33,17 +32,17 @@ public class Ctrl implements Disposable
private State state;
- public Ctrl(final TankOnTank game)
+ public Ctrl(final TankOnTank game, final Config cfg)
{
this.game = game;
+ this.cfg = cfg;
+ game.ctrl = this;
- this.cfg = new Config();
-
- this.factory = new Factory(game.manager);
- this.map = factory.getMap(this, game.manager, Factory.MapType.MAP_A);
-
- this.players[0] = factory.getPlayer(Army.GE);
- this.players[1] = factory.getPlayer(Army.US);
+ this.players[0] = game.factory.getPlayer(Army.GE);
+ this.players[1] = game.factory.getPlayer(Army.US);
+ this.map = game.factory.getMap(game, Factory.MapType.MAP_A);
+ game.factory.fakeSetup(map, players[0], players[1]);
+ player = (new java.util.Random()).nextInt(2);
this.selectState = new StateSelect(this, map);
this.pathState = new StateMove();
@@ -53,8 +52,6 @@ public class Ctrl implements Disposable
this.animationState = new StateAnimation();
this.state = selectState;
- factory.fakeSetup(map, players[0], players[1]);
- player = (new java.util.Random()).nextInt(2);
this.hud = new Hud(this, game);
@@ -66,7 +63,6 @@ public class Ctrl implements Disposable
{
hud.dispose();
map.dispose();
- factory.dispose();
}
public Player currentPlayer()