summaryrefslogtreecommitdiffstats
path: root/core/src/ch/asynk
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2014-10-14 12:30:32 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2014-10-14 12:30:32 +0200
commit6f1e3eeb6ca3971c3a209ec0dcbd2b5040c7db0b (patch)
tree29b29e1de70c459dd5ed35693dd3f506e3a85548 /core/src/ch/asynk
parent870cb69362a5df5532c875f9d79b0201381418b9 (diff)
downloadRustAndDust-6f1e3eeb6ca3971c3a209ec0dcbd2b5040c7db0b.zip
RustAndDust-6f1e3eeb6ca3971c3a209ec0dcbd2b5040c7db0b.tar.gz
Factory: use Unit.UnitId
Diffstat (limited to 'core/src/ch/asynk')
-rw-r--r--core/src/ch/asynk/tankontank/game/Factory.java106
1 files changed, 44 insertions, 62 deletions
diff --git a/core/src/ch/asynk/tankontank/game/Factory.java b/core/src/ch/asynk/tankontank/game/Factory.java
index ac4d671..5c70563 100644
--- a/core/src/ch/asynk/tankontank/game/Factory.java
+++ b/core/src/ch/asynk/tankontank/game/Factory.java
@@ -10,6 +10,8 @@ import com.badlogic.gdx.math.GridPoint2;
import ch.asynk.tankontank.engine.Board;
import ch.asynk.tankontank.engine.Orientation;
+import ch.asynk.tankontank.game.Unit.UnitId;
+import ch.asynk.tankontank.game.Unit.UnitType;
public class Factory implements Board.TileBuilder, Disposable
{
@@ -26,82 +28,62 @@ public class Factory implements Board.TileBuilder, Disposable
pawnAtlas.dispose();
}
- public enum UnitType
- {
- GE_AT_GUN,
- GE_INFANTRY,
- GE_KINGTIGER,
- GE_PANZER_IV,
- GE_PANZER_IV_HQ,
- GE_TIGER,
- GE_WESPE,
-
- US_AT_GUN,
- US_INFANTRY,
- US_PERSHING,
- US_PERSHING_HQ,
- US_PRIEST,
- US_SHERMAN,
- US_SHERMAN_HQ,
- US_WOLVERINE
- }
-
- public Unit getUnit(UnitType t)
+ public Unit getUnit(UnitId id)
{
Unit u = null;
- Unit.UnitType ut = Unit.UnitType.HARD_TARGET;
- Unit.UnitType utHq = Unit.UnitType.HARD_TARGET_HQ;
- switch(t) {
+ UnitType ut = UnitType.HARD_TARGET;
+ UnitType utHq = UnitType.HARD_TARGET_HQ;
+ switch(id) {
case GE_AT_GUN:
- ut = Unit.UnitType.AT_GUN;
- u = new Unit(Army.GE, ut, 3, 8, 9, 1, pawnAtlas, "ge-at-gun", "head");
+ ut = UnitType.AT_GUN;
+ u = new Unit(Army.GE, id, ut, 3, 8, 9, 1, pawnAtlas, "ge-at-gun", "head");
break;
case GE_INFANTRY:
- ut = Unit.UnitType.INFANTRY;
- u = new Unit(Army.GE, ut, 1, 7, 10, 1, pawnAtlas, "ge-infantry", "head");
+ ut = UnitType.INFANTRY;
+ u = new Unit(Army.GE, id, ut, 1, 7, 10, 1, pawnAtlas, "ge-infantry", "head");
break;
case GE_KINGTIGER:
- u = new Unit(Army.GE, ut, 3, 12, 1, pawnAtlas, "ge-kingtiger", "head");
+ u = new Unit(Army.GE, id, ut, 3, 12, 1, pawnAtlas, "ge-kingtiger", "head");
break;
case GE_PANZER_IV:
- u = new Unit(Army.GE, ut, 2, 9, 2, pawnAtlas, "ge-panzer-iv", "head");
+ u = new Unit(Army.GE, id, ut, 2, 9, 2, pawnAtlas, "ge-panzer-iv", "head");
break;
case GE_PANZER_IV_HQ:
- u = new Unit(Army.GE, utHq, 2, 9, 2, pawnAtlas, "ge-panzer-iv-hq", "head");
+ u = new Unit(Army.GE, id, utHq, 2, 9, 2, pawnAtlas, "ge-panzer-iv-hq", "head");
break;
case GE_TIGER:
- u = new Unit(Army.GE, ut, 3, 11, 1, pawnAtlas, "ge-tiger", "head");
+ u = new Unit(Army.GE, id, ut, 3, 11, 1, pawnAtlas, "ge-tiger", "head");
break;
case GE_WESPE:
- ut = Unit.UnitType.ARTILLERY;
- u = new Unit(Army.GE, ut, 5, 8, 1, pawnAtlas, "ge-wespe", "head");
+ ut = UnitType.ARTILLERY;
+ u = new Unit(Army.GE, id, ut, 5, 8, 1, pawnAtlas, "ge-wespe", "head");
break;
case US_AT_GUN:
- ut = Unit.UnitType.AT_GUN;
- u = new Unit(Army.US, ut, 1, 7, 10, 1, pawnAtlas, "us-at-gun", "head");
+ ut = UnitType.AT_GUN;
+ u = new Unit(Army.US, id, ut, 1, 7, 10, 1, pawnAtlas, "us-at-gun", "head");
break;
case US_INFANTRY:
- ut = Unit.UnitType.INFANTRY;
- u = new Unit(Army.US, ut, 1, 7, 10, 1, pawnAtlas, "us-infantry", "head");
+ ut = UnitType.INFANTRY;
+ u = new Unit(Army.US, id, ut, 1, 7, 10, 1, pawnAtlas, "us-infantry", "head");
break;
case US_PERSHING:
- u = new Unit(Army.US, ut, 3, 10, 2, pawnAtlas, "us-pershing", "head");
+ u = new Unit(Army.US, id, ut, 3, 10, 2, pawnAtlas, "us-pershing", "head");
break;
case US_PERSHING_HQ:
- u = new Unit(Army.US, utHq, 3, 10, 2, pawnAtlas, "us-pershing-hq", "head");
+ u = new Unit(Army.US, id, utHq, 3, 10, 2, pawnAtlas, "us-pershing-hq", "head");
break;
case US_PRIEST:
- ut = Unit.UnitType.ARTILLERY;
- u = new Unit(Army.US, ut, 5, 8, 1, pawnAtlas, "us-priest", "head");
+ ut = UnitType.ARTILLERY;
+ u = new Unit(Army.US, id, ut, 5, 8, 1, pawnAtlas, "us-priest", "head");
break;
case US_SHERMAN:
- u = new Unit(Army.US, ut, 2, 9, 2, pawnAtlas, "us-sherman", "us-sherman-head");
+ u = new Unit(Army.US, id, ut, 2, 9, 2, pawnAtlas, "us-sherman", "us-sherman-head");
break;
case US_SHERMAN_HQ:
- u = new Unit(Army.US, utHq, 2, 9, 2, pawnAtlas, "us-sherman-hq", "head");
+ u = new Unit(Army.US, id, utHq, 2, 9, 2, pawnAtlas, "us-sherman-hq", "head");
break;
case US_WOLVERINE:
- u = new Unit(Army.US, ut, 3, 8, 3, pawnAtlas, "us-wolverine", "head");
+ u = new Unit(Army.US, id, ut, 3, 8, 3, pawnAtlas, "us-wolverine", "head");
break;
}
@@ -166,25 +148,25 @@ public class Factory implements Board.TileBuilder, Disposable
Orientation o = Orientation.NORTH;
GridPoint2 p = new GridPoint2();
- gePlayer.addUnit(map.setPawnAt(getUnit(UnitType.GE_TIGER), p.set(4, 7), o));
- gePlayer.addUnit(map.setPawnAt(getUnit(UnitType.GE_TIGER), p.set(3, 6), o));
- gePlayer.addUnit(map.setPawnAt(getUnit(UnitType.GE_PANZER_IV), p.set(3, 5), o));
- gePlayer.addUnit(map.setPawnAt(getUnit(UnitType.GE_PANZER_IV_HQ), p.set(2, 4), o));
- gePlayer.addUnit(map.setPawnAt(getUnit(UnitType.GE_PANZER_IV), p.set(2, 3), o));
- gePlayer.addUnit(map.setPawnAt(getUnit(UnitType.GE_PANZER_IV), p.set(1, 2), o));
- gePlayer.addUnit(map.setPawnAt(getUnit(UnitType.GE_PANZER_IV_HQ), p.set(1, 1), o));
- gePlayer.addUnit(map.setPawnAt(getUnit(UnitType.GE_PANZER_IV), p.set(0, 0), o));
+ gePlayer.addUnit(map.setPawnAt(getUnit(UnitId.GE_TIGER), p.set(4, 7), o));
+ gePlayer.addUnit(map.setPawnAt(getUnit(UnitId.GE_TIGER), p.set(3, 6), o));
+ gePlayer.addUnit(map.setPawnAt(getUnit(UnitId.GE_PANZER_IV), p.set(3, 5), o));
+ gePlayer.addUnit(map.setPawnAt(getUnit(UnitId.GE_PANZER_IV_HQ), p.set(2, 4), o));
+ gePlayer.addUnit(map.setPawnAt(getUnit(UnitId.GE_PANZER_IV), p.set(2, 3), o));
+ gePlayer.addUnit(map.setPawnAt(getUnit(UnitId.GE_PANZER_IV), p.set(1, 2), o));
+ gePlayer.addUnit(map.setPawnAt(getUnit(UnitId.GE_PANZER_IV_HQ), p.set(1, 1), o));
+ gePlayer.addUnit(map.setPawnAt(getUnit(UnitId.GE_PANZER_IV), p.set(0, 0), o));
o = Orientation.SOUTH;
- usPlayer.addUnit(map.setPawnAt(getUnit(UnitType.US_WOLVERINE), p.set(13, 8), o));
- usPlayer.addUnit(map.setPawnAt(getUnit(UnitType.US_WOLVERINE), p.set(12, 7), o));
- usPlayer.addUnit(map.setPawnAt(getUnit(UnitType.US_PRIEST), p.set(12, 6), o));
- usPlayer.addUnit(map.setPawnAt(getUnit(UnitType.US_SHERMAN), p.set(11, 5), o));
- usPlayer.addUnit(map.setPawnAt(getUnit(UnitType.US_SHERMAN_HQ), p.set(11, 4), o));
- usPlayer.addUnit(map.setPawnAt(getUnit(UnitType.US_SHERMAN), p.set(10, 3), o));
- usPlayer.addUnit(map.setPawnAt(getUnit(UnitType.US_SHERMAN), p.set(10, 2), o));
- usPlayer.addUnit(map.setPawnAt(getUnit(UnitType.US_SHERMAN_HQ), p.set(9, 1), o));
- usPlayer.addUnit(map.setPawnAt(getUnit(UnitType.US_SHERMAN), p.set(9, 0), o));
+ usPlayer.addUnit(map.setPawnAt(getUnit(UnitId.US_WOLVERINE), p.set(13, 8), o));
+ usPlayer.addUnit(map.setPawnAt(getUnit(UnitId.US_WOLVERINE), p.set(12, 7), o));
+ usPlayer.addUnit(map.setPawnAt(getUnit(UnitId.US_PRIEST), p.set(12, 6), o));
+ usPlayer.addUnit(map.setPawnAt(getUnit(UnitId.US_SHERMAN), p.set(11, 5), o));
+ usPlayer.addUnit(map.setPawnAt(getUnit(UnitId.US_SHERMAN_HQ), p.set(11, 4), o));
+ usPlayer.addUnit(map.setPawnAt(getUnit(UnitId.US_SHERMAN), p.set(10, 3), o));
+ usPlayer.addUnit(map.setPawnAt(getUnit(UnitId.US_SHERMAN), p.set(10, 2), o));
+ usPlayer.addUnit(map.setPawnAt(getUnit(UnitId.US_SHERMAN_HQ), p.set(9, 1), o));
+ usPlayer.addUnit(map.setPawnAt(getUnit(UnitId.US_SHERMAN), p.set(9, 0), o));
return usPlayer;
}