diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2014-10-04 18:50:29 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2014-10-04 18:50:29 +0200 |
commit | a8ac789fbc6efde89e99ba2fbcb7546af4ca1c19 (patch) | |
tree | 951563fb4a18f7c3586d8d6b6829b5c6d1339fe0 | |
parent | b8c952ff5a8ad12d8ae116698da89571a63a5249 (diff) | |
download | RustAndDust-a8ac789fbc6efde89e99ba2fbcb7546af4ca1c19.zip RustAndDust-a8ac789fbc6efde89e99ba2fbcb7546af4ca1c19.tar.gz |
pawn setup goes from GameScreen to GameFactory.fakeSetup(Map)
-rw-r--r-- | core/src/ch/asynk/tankontank/game/GameFactory.java | 26 | ||||
-rw-r--r-- | core/src/ch/asynk/tankontank/screens/GameScreen.java | 34 |
2 files changed, 27 insertions, 33 deletions
diff --git a/core/src/ch/asynk/tankontank/game/GameFactory.java b/core/src/ch/asynk/tankontank/game/GameFactory.java index d18dc8f..fbc81be 100644 --- a/core/src/ch/asynk/tankontank/game/GameFactory.java +++ b/core/src/ch/asynk/tankontank/game/GameFactory.java @@ -6,7 +6,10 @@ import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.g2d.TextureAtlas; import com.badlogic.gdx.graphics.g2d.TextureRegion; +import com.badlogic.gdx.math.GridPoint2; + import ch.asynk.tankontank.engine.Board; +import ch.asynk.tankontank.engine.Orientation; public class GameFactory implements Board.TileBuilder, Disposable { @@ -141,4 +144,27 @@ public class GameFactory implements Board.TileBuilder, Disposable { return new Hex(cx, cy, pawnAtlas); } + + public void fakeSetup(Map map) + { + Orientation o = Orientation.NORTH; + GridPoint2 p = new GridPoint2(); + map.setPawnAt(getUnit(UnitType.GE_AT_GUN), p.set(4, 7), o); + map.setPawnAt(getUnit(UnitType.GE_INFANTRY), p.set(3, 6), o); + map.setPawnAt(getUnit(UnitType.GE_KINGTIGER), p.set(3, 5), o); + map.setPawnAt(getUnit(UnitType.GE_PANZER_IV), p.set(2, 4), o); + map.setPawnAt(getUnit(UnitType.GE_PANZER_IV_HQ), p.set(2, 3), o); + map.setPawnAt(getUnit(UnitType.GE_TIGER), p.set(1, 2), o); + map.setPawnAt(getUnit(UnitType.GE_WESPE), p.set(1, 1), o); + + o = Orientation.SOUTH; + map.setPawnAt(getUnit(UnitType.US_AT_GUN), p.set(12, 7), o); + map.setPawnAt(getUnit(UnitType.US_INFANTRY), p.set(11, 6), o); + map.setPawnAt(getUnit(UnitType.US_PERSHING), p.set(11, 5), o); + map.setPawnAt(getUnit(UnitType.US_PERSHING_HQ), p.set(10, 4), o); + map.setPawnAt(getUnit(UnitType.US_PRIEST), p.set(10, 3), o); + map.setPawnAt(getUnit(UnitType.US_SHERMAN), p.set(9, 2), o); + map.setPawnAt(getUnit(UnitType.US_SHERMAN_HQ), p.set(9, 1), o); + map.setPawnAt(getUnit(UnitType.US_WOLVERINE), p.set(8, 0), o); + } } diff --git a/core/src/ch/asynk/tankontank/screens/GameScreen.java b/core/src/ch/asynk/tankontank/screens/GameScreen.java index 9e3bff5..736a499 100644 --- a/core/src/ch/asynk/tankontank/screens/GameScreen.java +++ b/core/src/ch/asynk/tankontank/screens/GameScreen.java @@ -30,11 +30,6 @@ import ch.asynk.tankontank.game.Hud; import ch.asynk.tankontank.game.Map; import ch.asynk.tankontank.game.GameCtrl; import ch.asynk.tankontank.game.GameFactory; -import ch.asynk.tankontank.game.GameFactory.UnitType; -// TEST -import ch.asynk.tankontank.engine.Pawn; -import ch.asynk.tankontank.engine.Board; -import ch.asynk.tankontank.engine.Orientation; public class GameScreen implements Screen { @@ -87,39 +82,12 @@ public class GameScreen implements Screen ctrl = new GameCtrl(map); + factory.fakeSetup(map); // DEBUG debugShapes = new ShapeRenderer(); - - // TEST - Orientation o = Orientation.NORTH; - addUnit(4, 7, o, UnitType.GE_AT_GUN); - addUnit(3, 6, o, UnitType.GE_INFANTRY); - addUnit(3, 5, o, UnitType.GE_KINGTIGER); - addUnit(2, 4, o, UnitType.GE_PANZER_IV); - addUnit(2, 3, o, UnitType.GE_PANZER_IV_HQ); - addUnit(1, 2, o, UnitType.GE_TIGER); - addUnit(1, 1, o, UnitType.GE_WESPE); - - o = Orientation.SOUTH; - addUnit(12, 7, o, UnitType.US_AT_GUN); - addUnit(11, 6, o, UnitType.US_INFANTRY); - addUnit(11, 5, o, UnitType.US_PERSHING); - addUnit(10, 4, o, UnitType.US_PERSHING_HQ); - addUnit(10, 3, o, UnitType.US_PRIEST); - addUnit(9, 2, o, UnitType.US_SHERMAN); - addUnit(9, 1, o, UnitType.US_SHERMAN_HQ); - addUnit(8, 0, o, UnitType.US_WOLVERINE); - // TEST - Gdx.input.setInputProcessor(getMultiplexer()); } - private void addUnit(int col, int row, Orientation o, UnitType t) - { - Pawn p = factory.getUnit(t); - GridPoint2 coords = new GridPoint2(col, row); - map.setPawnAt(p, coords, o); - } private InputMultiplexer getMultiplexer() { |