summaryrefslogtreecommitdiffstats
path: root/core/src
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2014-09-25 00:07:33 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2014-09-25 00:07:33 +0200
commite8d5b0eab9963cf9dd644b4709333ef30fcaf310 (patch)
tree49753dd6d3a417b8a7f1e983f586c5ff081e0e11 /core/src
parent357eddc4a412bb928787ab02f5e0f4c3caf74100 (diff)
downloadRustAndDust-e8d5b0eab9963cf9dd644b4709333ef30fcaf310.zip
RustAndDust-e8d5b0eab9963cf9dd644b4709333ef30fcaf310.tar.gz
Unit extends HeadedPawn
Diffstat (limited to 'core/src')
-rw-r--r--core/src/ch/asynk/tankontank/game/GameFactory.java30
-rw-r--r--core/src/ch/asynk/tankontank/game/Unit.java13
2 files changed, 23 insertions, 20 deletions
diff --git a/core/src/ch/asynk/tankontank/game/GameFactory.java b/core/src/ch/asynk/tankontank/game/GameFactory.java
index 43806cf..5ccb419 100644
--- a/core/src/ch/asynk/tankontank/game/GameFactory.java
+++ b/core/src/ch/asynk/tankontank/game/GameFactory.java
@@ -57,49 +57,49 @@ public class GameFactory implements Disposable
Unit u = null;
switch(t) {
case GE_AT_GUN:
- u = new Unit(Army.GE, false, 3, 8, 9, 1, geAtlas.findRegion("at-gun"), unitAtlas);
+ u = new Unit(Army.GE, false, 3, 8, 9, 1, geAtlas.findRegion("at-gun"), geAtlas.findRegion("head"), unitAtlas);
break;
case GE_INFANTRY:
- u = new Unit(Army.GE, false, 1, 7, 10, 1, geAtlas.findRegion("infantry"), unitAtlas);
+ u = new Unit(Army.GE, false, 1, 7, 10, 1, geAtlas.findRegion("infantry"), geAtlas.findRegion("head"), unitAtlas);
break;
case GE_KINGTIGER:
- u = new Unit(Army.GE, false, 3, 12, 1, geAtlas.findRegion("kingtiger"), unitAtlas);
+ u = new Unit(Army.GE, false, 3, 12, 1, geAtlas.findRegion("kingtiger"), geAtlas.findRegion("head"), unitAtlas);
break;
case GE_PANZER_IV:
- u = new Unit(Army.GE, false, 2, 9, 2, geAtlas.findRegion("panzer-iv"), unitAtlas);
+ u = new Unit(Army.GE, false, 2, 9, 2, geAtlas.findRegion("panzer-iv"), geAtlas.findRegion("head"), unitAtlas);
break;
case GE_PANZER_IV_HQ:
- u = new Unit(Army.GE, true, 2, 9, 2, geAtlas.findRegion("panzer-iv-hq"), unitAtlas);
+ u = new Unit(Army.GE, true, 2, 9, 2, geAtlas.findRegion("panzer-iv-hq"), geAtlas.findRegion("head"), unitAtlas);
break;
case GE_TIGER:
- u = new Unit(Army.GE, false, 3, 11, 1, geAtlas.findRegion("tiger"), unitAtlas);
+ u = new Unit(Army.GE, false, 3, 11, 1, geAtlas.findRegion("tiger"), geAtlas.findRegion("head"), unitAtlas);
break;
case GE_WESPE:
- u = new Unit(Army.GE, false, 5, 8, 1, geAtlas.findRegion("wespe"), unitAtlas);
+ u = new Unit(Army.GE, false, 5, 8, 1, geAtlas.findRegion("wespe"), geAtlas.findRegion("head"), unitAtlas);
break;
case US_AT_GUN:
- u = new Unit(Army.US, false, 1, 7, 10, 1, usAtlas.findRegion("at-gun"), unitAtlas);
+ u = new Unit(Army.US, false, 1, 7, 10, 1, usAtlas.findRegion("at-gun"), usAtlas.findRegion("head"), unitAtlas);
break;
case US_INFANTRY:
- u = new Unit(Army.US, false, 1, 7, 10, 1, usAtlas.findRegion("infantry"), unitAtlas);
+ u = new Unit(Army.US, false, 1, 7, 10, 1, usAtlas.findRegion("infantry"), usAtlas.findRegion("head"), unitAtlas);
break;
case US_PERSHING:
- u = new Unit(Army.US, false, 3, 10, 2, usAtlas.findRegion("pershing"), unitAtlas);
+ u = new Unit(Army.US, false, 3, 10, 2, usAtlas.findRegion("pershing"), usAtlas.findRegion("head"), unitAtlas);
break;
case US_PERSHING_HQ:
- u = new Unit(Army.US, true, 3, 10, 2, usAtlas.findRegion("pershing-hq"), unitAtlas);
+ u = new Unit(Army.US, true, 3, 10, 2, usAtlas.findRegion("pershing-hq"), usAtlas.findRegion("head"), unitAtlas);
break;
case US_PRIEST:
- u = new Unit(Army.US, false, 5, 8, 1, usAtlas.findRegion("priest"), unitAtlas);
+ u = new Unit(Army.US, false, 5, 8, 1, usAtlas.findRegion("priest"), usAtlas.findRegion("head"), unitAtlas);
break;
case US_SHERMAN:
- u = new Unit(Army.US, false, 2, 9, 2, usAtlas.findRegion("sherman"), unitAtlas);
+ u = new Unit(Army.US, false, 2, 9, 2, usAtlas.findRegion("sherman"), usAtlas.findRegion("head"), unitAtlas);
break;
case US_SHERMAN_HQ:
- u = new Unit(Army.US, true, 2, 9, 2, usAtlas.findRegion("sherman-hq"), unitAtlas);
+ u = new Unit(Army.US, true, 2, 9, 2, usAtlas.findRegion("sherman-hq"), usAtlas.findRegion("head"), unitAtlas);
break;
case US_WOLVERINE:
- u = new Unit(Army.US, false, 3, 8, 3, usAtlas.findRegion("wolverine"), unitAtlas);
+ u = new Unit(Army.US, false, 3, 8, 3, usAtlas.findRegion("wolverine"), usAtlas.findRegion("head"), unitAtlas);
break;
}
diff --git a/core/src/ch/asynk/tankontank/game/Unit.java b/core/src/ch/asynk/tankontank/game/Unit.java
index d9f0789..d4eaf5b 100644
--- a/core/src/ch/asynk/tankontank/game/Unit.java
+++ b/core/src/ch/asynk/tankontank/game/Unit.java
@@ -4,9 +4,12 @@ import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
import ch.asynk.tankontank.engine.Pawn;
+import ch.asynk.tankontank.engine.HeadedPawn;
-public class Unit extends Pawn
+public class Unit extends HeadedPawn
{
+ public static final int DISABLED = 0;
+
public int rng;
public int def;
public int cdef;
@@ -34,9 +37,9 @@ public class Unit extends Pawn
}
// hard tager
- public Unit(Army army, boolean hq, int range, int defense, int movementPoints, TextureRegion region, TextureAtlas atlas)
+ public Unit(Army army, boolean hq, int range, int defense, int movementPoints, TextureRegion unit, TextureRegion head, TextureAtlas overlays)
{
- super(region, atlas);
+ super(unit, head, overlays);
this.army = army;
this.hq = hq;
this.rng = range;
@@ -46,9 +49,9 @@ public class Unit extends Pawn
}
// soft tager
- public Unit(Army army, boolean hq, int range, int defense, int concealedDefense, int movementPoints, TextureRegion region, TextureAtlas atlas)
+ public Unit(Army army, boolean hq, int range, int defense, int concealedDefense, int movementPoints, TextureRegion unit, TextureRegion head, TextureAtlas overlays)
{
- super(region, atlas);
+ super(unit, head, overlays);
this.army = army;
this.hq = hq;
this.rng = range;