diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2014-10-16 15:45:16 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2014-10-16 15:45:16 +0200 |
commit | 10acc97532eec265dabb697c67185dff387fe27b (patch) | |
tree | c30f53602860e9990cb15aebf491065d4bed3268 /core | |
parent | 125708799076a89dcf4ed94326128ec787ec7ec7 (diff) | |
download | RustAndDust-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.java | 2 | ||||
-rw-r--r-- | core/src/ch/asynk/tankontank/game/Ctrl.java | 20 |
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() |