summaryrefslogtreecommitdiffstats
path: root/core/src/ch
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2014-09-22 17:22:03 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2014-09-22 17:22:03 +0200
commit2d3e390584585808882793f4b7b6a3d60c67a447 (patch)
treecd84af7873cefdaa08ad0dbccec4c7e42bb1606c /core/src/ch
parent075e6b5a9a8e7dea0252bb2972364b5cc1954a91 (diff)
downloadRustAndDust-2d3e390584585808882793f4b7b6a3d60c67a447.zip
RustAndDust-2d3e390584585808882793f4b7b6a3d60c67a447.tar.gz
add unitAtlas
Diffstat (limited to 'core/src/ch')
-rw-r--r--core/src/ch/asynk/tankontank/TankOnTank.java2
-rw-r--r--core/src/ch/asynk/tankontank/game/GameFactory.java33
-rw-r--r--core/src/ch/asynk/tankontank/game/Unit.java8
3 files changed, 24 insertions, 19 deletions
diff --git a/core/src/ch/asynk/tankontank/TankOnTank.java b/core/src/ch/asynk/tankontank/TankOnTank.java
index 57bd092..c9f29c9 100644
--- a/core/src/ch/asynk/tankontank/TankOnTank.java
+++ b/core/src/ch/asynk/tankontank/TankOnTank.java
@@ -37,6 +37,7 @@ public class TankOnTank extends Game
manager.load("images/ge.atlas", TextureAtlas.class);
manager.load("images/us.atlas", TextureAtlas.class);
manager.load("images/hex.atlas", TextureAtlas.class);
+ manager.load("images/unit.atlas", TextureAtlas.class);
// manager.load("images/cup.jpg", Texture.class);
// manager.load("images/small.png", Texture.class);
}
@@ -52,6 +53,7 @@ public class TankOnTank extends Game
manager.unload("images/ge.atlas");
manager.unload("images/us.atlas");
manager.unload("images/hex.atlas");
+ manager.unload("images/unit.atlas");
// manager.unload("images/cup.jpg");
// manager.unload("images/small.png");
Gdx.app.debug("TankOnTank", "diagnostics:\n" + manager.getDiagnostics() );
diff --git a/core/src/ch/asynk/tankontank/game/GameFactory.java b/core/src/ch/asynk/tankontank/game/GameFactory.java
index f3a5150..7a9c5b5 100644
--- a/core/src/ch/asynk/tankontank/game/GameFactory.java
+++ b/core/src/ch/asynk/tankontank/game/GameFactory.java
@@ -12,12 +12,14 @@ public class GameFactory
private static TextureAtlas usAtlas;
private static TextureAtlas geAtlas;
private static TextureAtlas hexAtlas;
+ private static TextureAtlas unitAtlas;
public static void init(AssetManager manager)
{
usAtlas = manager.get("images/us.atlas", TextureAtlas.class);
geAtlas = manager.get("images/ge.atlas", TextureAtlas.class);
hexAtlas = manager.get("images/hex.atlas", TextureAtlas.class);
+ unitAtlas = manager.get("images/unit.atlas", TextureAtlas.class);
}
public static void dispose()
@@ -25,6 +27,7 @@ public class GameFactory
usAtlas.dispose();
geAtlas.dispose();
hexAtlas.dispose();
+ unitAtlas.dispose();
}
public enum UnitType
@@ -52,49 +55,49 @@ public class GameFactory
Unit u = null;
switch(t) {
case GE_AT_GUN:
- u = new Unit(Army.GE, false, 3, 8, 9, 1, geAtlas.findRegion("at-gun"));
+ u = new Unit(Army.GE, false, 3, 8, 9, 1, geAtlas.findRegion("at-gun"), unitAtlas);
break;
case GE_INFANTRY:
- u = new Unit(Army.GE, false, 1, 7, 10, 1, geAtlas.findRegion("infantry"));
+ u = new Unit(Army.GE, false, 1, 7, 10, 1, geAtlas.findRegion("infantry"), unitAtlas);
break;
case GE_KINGTIGER:
- u = new Unit(Army.GE, false, 3, 12, 1, geAtlas.findRegion("kingtiger"));
+ u = new Unit(Army.GE, false, 3, 12, 1, geAtlas.findRegion("kingtiger"), unitAtlas);
break;
case GE_PANZER_IV:
- u = new Unit(Army.GE, false, 2, 9, 2, geAtlas.findRegion("panzer-iv"));
+ u = new Unit(Army.GE, false, 2, 9, 2, geAtlas.findRegion("panzer-iv"), unitAtlas);
break;
case GE_PANZER_IV_HQ:
- u = new Unit(Army.GE, true, 2, 9, 2, geAtlas.findRegion("panzer-iv-hq"));
+ u = new Unit(Army.GE, true, 2, 9, 2, geAtlas.findRegion("panzer-iv-hq"), unitAtlas);
break;
case GE_TIGER:
- u = new Unit(Army.GE, false, 3, 11, 1, geAtlas.findRegion("tiger"));
+ u = new Unit(Army.GE, false, 3, 11, 1, geAtlas.findRegion("tiger"), unitAtlas);
break;
case GE_WESPE:
- u = new Unit(Army.GE, false, 5, 8, 1, geAtlas.findRegion("wespe"));
+ u = new Unit(Army.GE, false, 5, 8, 1, geAtlas.findRegion("wespe"), unitAtlas);
break;
case US_AT_GUN:
- u = new Unit(Army.US, false, 1, 7, 10, 1, usAtlas.findRegion("at-gun"));
+ u = new Unit(Army.US, false, 1, 7, 10, 1, usAtlas.findRegion("at-gun"), unitAtlas);
break;
case US_INFANTRY:
- u = new Unit(Army.US, false, 1, 7, 10, 1, usAtlas.findRegion("infantry"));
+ u = new Unit(Army.US, false, 1, 7, 10, 1, usAtlas.findRegion("infantry"), unitAtlas);
break;
case US_PERSHING:
- u = new Unit(Army.US, false, 3, 10, 2, usAtlas.findRegion("pershing"));
+ u = new Unit(Army.US, false, 3, 10, 2, usAtlas.findRegion("pershing"), unitAtlas);
break;
case US_PERSHING_HQ:
- u = new Unit(Army.US, true, 3, 10, 2, usAtlas.findRegion("pershing-hq"));
+ u = new Unit(Army.US, true, 3, 10, 2, usAtlas.findRegion("pershing-hq"), unitAtlas);
break;
case US_PRIEST:
- u = new Unit(Army.US, false, 5, 8, 1, usAtlas.findRegion("priest"));
+ u = new Unit(Army.US, false, 5, 8, 1, usAtlas.findRegion("priest"), unitAtlas);
break;
case US_SHERMAN:
- u = new Unit(Army.US, false, 2, 9, 2, usAtlas.findRegion("sherman"));
+ u = new Unit(Army.US, false, 2, 9, 2, usAtlas.findRegion("sherman"), unitAtlas);
break;
case US_SHERMAN_HQ:
- u = new Unit(Army.US, true, 2, 9, 2, usAtlas.findRegion("sherman-hq"));
+ u = new Unit(Army.US, true, 2, 9, 2, usAtlas.findRegion("sherman-hq"), unitAtlas);
break;
case US_WOLVERINE:
- u = new Unit(Army.US, false, 3, 8, 3, usAtlas.findRegion("wolverine"));
+ u = new Unit(Army.US, false, 3, 8, 3, usAtlas.findRegion("wolverine"), unitAtlas);
break;
}
diff --git a/core/src/ch/asynk/tankontank/game/Unit.java b/core/src/ch/asynk/tankontank/game/Unit.java
index 3a144b2..316f664 100644
--- a/core/src/ch/asynk/tankontank/game/Unit.java
+++ b/core/src/ch/asynk/tankontank/game/Unit.java
@@ -16,9 +16,9 @@ public class Unit extends Pawn
public Army army;
// hard tager
- public Unit(Army army, boolean hq, int range, int defense, int movementPoints, TextureRegion region)
+ public Unit(Army army, boolean hq, int range, int defense, int movementPoints, TextureRegion region, TextureAtlas atlas)
{
- super(region);
+ super(region, atlas);
this.army = army;
this.hq = hq;
this.rng = range;
@@ -28,9 +28,9 @@ public class Unit extends Pawn
}
// soft tager
- public Unit(Army army, boolean hq, int range, int defense, int concealedDefense, int movementPoints, TextureRegion region)
+ public Unit(Army army, boolean hq, int range, int defense, int concealedDefense, int movementPoints, TextureRegion region, TextureAtlas atlas)
{
- super(region);
+ super(region, atlas);
this.army = army;
this.hq = hq;
this.rng = range;