diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2015-12-29 07:53:28 +0100 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2015-12-29 07:53:28 +0100 |
commit | b49dd88171a0f17b683b10bfc8f86c199ef21c57 (patch) | |
tree | aac9b52c6bc24e38705de126d81126f4507828e8 /core/src/ch/asynk/rustanddust/game | |
parent | 99f74fefd00c38a815316ed6ec2c84144a1e91ff (diff) | |
download | RustAndDust-b49dd88171a0f17b683b10bfc8f86c199ef21c57.zip RustAndDust-b49dd88171a0f17b683b10bfc8f86c199ef21c57.tar.gz |
HeadedPawn: has a chit, a body and a turret that can aim
Diffstat (limited to 'core/src/ch/asynk/rustanddust/game')
-rw-r--r-- | core/src/ch/asynk/rustanddust/game/Factory.java | 30 | ||||
-rw-r--r-- | core/src/ch/asynk/rustanddust/game/Unit.java | 9 |
2 files changed, 26 insertions, 13 deletions
diff --git a/core/src/ch/asynk/rustanddust/game/Factory.java b/core/src/ch/asynk/rustanddust/game/Factory.java index d65edd9..fbcd658 100644 --- a/core/src/ch/asynk/rustanddust/game/Factory.java +++ b/core/src/ch/asynk/rustanddust/game/Factory.java @@ -161,17 +161,12 @@ public class Factory implements Board.TileBuilder, Disposable return u; } - private Unit buildUnit(Army army, UnitId id, UnitType ut, boolean hq, boolean ace, int a, int d, int cd, int m, String body) + private Unit buildUnit(Army army, UnitId id, UnitType ut, boolean hq, boolean ace, int a, int d, int cd, int m, String chit) { - return new Unit(army, id, ut, hq, ace, a, d, cd, m, getUnitRegion(body), getHead(army, body), unitOverlaysAtlas); + return new Unit(army, id, ut, hq, ace, a, d, cd, m, getUnitRegion(chit), getBody(army, chit), getTurret(army, chit), unitOverlaysAtlas); } - private AtlasRegion getUnitRegion(String s) - { - return unitsAtlas.findRegion(s); - } - - private AtlasRegion getHead(Army army, String body) + private AtlasRegion getBody(Army army, String chit) { String head = null; switch(game.config.graphics) { @@ -179,12 +174,29 @@ public class Factory implements Board.TileBuilder, Disposable head = ((army == Army.US) ? "us-head" : "ge-head"); break; case TANKS: - head = body + "-head"; + head = chit + "-head"; break; } return getUnitRegion(head); } + private AtlasRegion getTurret(Army army, String chit) + { + String turret = null; + switch(game.config.graphics) { + case CHITS: + break; + case TANKS: + break; + } + return getUnitRegion(turret); + } + + private AtlasRegion getUnitRegion(String s) + { + return ((s == null) ? null : unitsAtlas.findRegion(s)); + } + public Hex getNewTile(float x, float y, int col, int row, boolean offmap) { Hex hex = new Hex(x, y, col, row, hexOverlaysAtlas, Army.NONE); diff --git a/core/src/ch/asynk/rustanddust/game/Unit.java b/core/src/ch/asynk/rustanddust/game/Unit.java index 0027a18..a006fb9 100644 --- a/core/src/ch/asynk/rustanddust/game/Unit.java +++ b/core/src/ch/asynk/rustanddust/game/Unit.java @@ -64,9 +64,9 @@ public class Unit extends HeadedPawn private boolean hasMoved; private boolean hasFired; - protected Unit(Army army, AtlasRegion body, AtlasRegion head, TextureAtlas overlays) + protected Unit(Army army, AtlasRegion chit, AtlasRegion body, AtlasRegion turret, TextureAtlas overlays) { - super(army, body, head, overlays); + super(army, chit, body, turret, overlays); hq = false; ace = false; @@ -90,9 +90,10 @@ public class Unit extends HeadedPawn this.descr = id.toString() + (hq ? " HQ " : "") + (ace ? " Ace " : "") + " (" + rng + "-" + def + "/" + cdef + "-" + mp + ")"; } - public Unit(Army army, UnitId id, UnitType type, boolean hq, boolean ace, int range, int defense, int concealedDefense, int movementPoints, AtlasRegion body, AtlasRegion head, TextureAtlas overlays) + public Unit(Army army, UnitId id, UnitType type, boolean hq, boolean ace, int range, int defense, int concealedDefense, int movementPoints, + AtlasRegion chit, AtlasRegion body, AtlasRegion turret, TextureAtlas overlays) { - this(army, body, head, overlays); + this(army, chit, body, turret, overlays); this.hq = hq; this.ace = ace; this.rng = range; |