diff options
Diffstat (limited to 'core/src')
-rw-r--r-- | core/src/ch/asynk/rustanddust/engine/HeadedPawn.java | 20 | ||||
-rw-r--r-- | core/src/ch/asynk/rustanddust/game/Factory.java | 3 | ||||
-rw-r--r-- | core/src/ch/asynk/rustanddust/game/Unit.java | 8 |
3 files changed, 21 insertions, 10 deletions
diff --git a/core/src/ch/asynk/rustanddust/engine/HeadedPawn.java b/core/src/ch/asynk/rustanddust/engine/HeadedPawn.java index 90de097..faac25a 100644 --- a/core/src/ch/asynk/rustanddust/engine/HeadedPawn.java +++ b/core/src/ch/asynk/rustanddust/engine/HeadedPawn.java @@ -12,6 +12,8 @@ public abstract class HeadedPawn extends Pawn private Sprite body; private float turretR; private boolean canAim; + private boolean selectable; + private boolean selected; protected Orientation orientation; protected HeadedPawn() @@ -20,7 +22,7 @@ public abstract class HeadedPawn extends Pawn this.orientation = Orientation.KEEP; } - public HeadedPawn(Faction faction, AtlasRegion chit, AtlasRegion body, AtlasRegion turret, TextureAtlas overlays) + public HeadedPawn(Faction faction, AtlasRegion chit, AtlasRegion body, AtlasRegion turret, TextureAtlas overlays, boolean selectable) { super(faction, chit, overlays); this.body = new Sprite(body); @@ -29,6 +31,14 @@ public abstract class HeadedPawn extends Pawn this.orientation = Orientation.KEEP; this.descr += " " + orientation; this.canAim = (turret != null); + this.selectable = selectable; + this.selected = !selectable; + } + + public void select(boolean s) + { + if (!selectable) return; + this.selected = s; } @Override @@ -110,10 +120,10 @@ public abstract class HeadedPawn extends Pawn @Override public void draw(Batch batch) { - sprite.draw(batch); + if (selected) sprite.draw(batch); body.draw(batch); if (canAim) turret.draw(batch); - overlays.draw(batch); + if (selected) overlays.draw(batch); } @Override @@ -121,7 +131,7 @@ public abstract class HeadedPawn extends Pawn { float w = sprite.getWidth(); float h = sprite.getHeight(); - debugShapes.rect(sprite.getX(), sprite.getY(), (w / 2f), (h / 2f), w, h, sprite.getScaleX(), sprite.getScaleY(), sprite.getRotation()); + if (selected) debugShapes.rect(sprite.getX(), sprite.getY(), (w / 2f), (h / 2f), w, h, sprite.getScaleX(), sprite.getScaleY(), sprite.getRotation()); w = body.getWidth(); h = body.getHeight(); debugShapes.rect(body.getX(), body.getY(), (w / 2f), (h / 2f), w, h, body.getScaleX(), body.getScaleY(), body.getRotation()); @@ -130,6 +140,6 @@ public abstract class HeadedPawn extends Pawn h = turret.getHeight(); debugShapes.rect(turret.getX(), turret.getY(), (w / 2f), (h / 2f), w, h, turret.getScaleX(), turret.getScaleY(), turret.getRotation()); } - overlays.drawDebug(debugShapes); + if (selected) overlays.drawDebug(debugShapes); } } diff --git a/core/src/ch/asynk/rustanddust/game/Factory.java b/core/src/ch/asynk/rustanddust/game/Factory.java index f48094e..b7c4838 100644 --- a/core/src/ch/asynk/rustanddust/game/Factory.java +++ b/core/src/ch/asynk/rustanddust/game/Factory.java @@ -176,7 +176,8 @@ public class Factory implements Board.TileBuilder, Disposable private Unit buildUnit(Army army, UnitCode code, UnitType ut, boolean hq, boolean ace, int a, int d, int cd, int m, String chit) { - return new Unit(army, code, ut, hq, ace, a, d, cd, m, getUnitRegion(chit), getBody(army, chit), getTurret(army, chit), unitOverlaysAtlas); + boolean selectable = (game.config.graphics == Config.Graphics.TANKS); + return new Unit(army, code, ut, hq, ace, a, d, cd, m, getUnitRegion(chit), getBody(army, chit), getTurret(army, chit), unitOverlaysAtlas, selectable); } private AtlasRegion getBody(Army army, String chit) diff --git a/core/src/ch/asynk/rustanddust/game/Unit.java b/core/src/ch/asynk/rustanddust/game/Unit.java index 36bea6b..8384282 100644 --- a/core/src/ch/asynk/rustanddust/game/Unit.java +++ b/core/src/ch/asynk/rustanddust/game/Unit.java @@ -83,9 +83,9 @@ public class Unit extends HeadedPawn public Zone entryZone; public Zone exitZone; - protected Unit(Army army, AtlasRegion chit, AtlasRegion body, AtlasRegion turret, TextureAtlas overlays) + protected Unit(Army army, AtlasRegion chit, AtlasRegion body, AtlasRegion turret, TextureAtlas overlays, boolean selectable) { - super(army, chit, body, turret, overlays); + super(army, chit, body, turret, overlays, selectable); hq = false; ace = false; if (!blockId) { @@ -117,9 +117,9 @@ public class Unit extends HeadedPawn } public Unit(Army army, UnitCode code, UnitType type, boolean hq, boolean ace, int range, int defense, int concealedDefense, int movementPoints, - AtlasRegion chit, AtlasRegion body, AtlasRegion turret, TextureAtlas overlays) + AtlasRegion chit, AtlasRegion body, AtlasRegion turret, TextureAtlas overlays, boolean selectable) { - this(army, chit, body, turret, overlays); + this(army, chit, body, turret, overlays, selectable); this.hq = hq; this.ace = ace; this.rng = range; |