summaryrefslogtreecommitdiffstats
path: root/core/src/ch/asynk/tankontank
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2014-09-16 23:02:37 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2014-09-16 23:02:37 +0200
commitc92d75e6065d1a4b23a8d4fd39303b24d62c5008 (patch)
treefd6bfc0e3bf1d8c25eaf256b133be58e1c7c2c4c /core/src/ch/asynk/tankontank
parent380b0aee558462ed63aaab0398d9d0a31c635442 (diff)
downloadRustAndDust-c92d75e6065d1a4b23a8d4fd39303b24d62c5008.zip
RustAndDust-c92d75e6065d1a4b23a8d4fd39303b24d62c5008.tar.gz
HexOrientation -> Hex.Orientation
Diffstat (limited to 'core/src/ch/asynk/tankontank')
-rw-r--r--core/src/ch/asynk/tankontank/game/Hex.java18
-rw-r--r--core/src/ch/asynk/tankontank/game/HexMap.java4
-rw-r--r--core/src/ch/asynk/tankontank/game/HexMapImage.java6
-rw-r--r--core/src/ch/asynk/tankontank/game/HexOrientation.java15
-rw-r--r--core/src/ch/asynk/tankontank/game/Pawn.java2
-rw-r--r--core/src/ch/asynk/tankontank/game/PawnImage.java6
-rw-r--r--core/src/ch/asynk/tankontank/screens/GameScreen.java8
7 files changed, 31 insertions, 28 deletions
diff --git a/core/src/ch/asynk/tankontank/game/Hex.java b/core/src/ch/asynk/tankontank/game/Hex.java
new file mode 100644
index 0000000..2c653e6
--- /dev/null
+++ b/core/src/ch/asynk/tankontank/game/Hex.java
@@ -0,0 +1,18 @@
+package ch.asynk.tankontank.game;
+
+public interface Hex
+{
+ public enum Orientation
+ {
+ KEEP(0),
+ WEST(-90),
+ NORTH_WEST(-30),
+ NORTH_EAST (30),
+ EAST(90),
+ SOUTH_EAST(150),
+ SOUTH_WEST(-150);
+
+ public final int v;
+ Orientation(int v) { this.v = v; }
+ }
+}
diff --git a/core/src/ch/asynk/tankontank/game/HexMap.java b/core/src/ch/asynk/tankontank/game/HexMap.java
index 7207270..1d751a6 100644
--- a/core/src/ch/asynk/tankontank/game/HexMap.java
+++ b/core/src/ch/asynk/tankontank/game/HexMap.java
@@ -23,9 +23,9 @@ public interface HexMap
public void movePawnTo(Pawn pawn, Vector3 coords);
- public void setPawnAt(Pawn pawn, int col, int row, HexOrientation o);
+ public void setPawnAt(Pawn pawn, int col, int row, Hex.Orientation o);
- public void movePawnTo(Pawn pawn, int col, int row, HexOrientation o);
+ public void movePawnTo(Pawn pawn, int col, int row, Hex.Orientation o);
public class Config
{
diff --git a/core/src/ch/asynk/tankontank/game/HexMapImage.java b/core/src/ch/asynk/tankontank/game/HexMapImage.java
index 2f14ef1..b391f8b 100644
--- a/core/src/ch/asynk/tankontank/game/HexMapImage.java
+++ b/core/src/ch/asynk/tankontank/game/HexMapImage.java
@@ -88,17 +88,17 @@ public class HexMapImage extends Image implements HexMap
public void movePawnTo(Pawn pawn, Vector3 coords)
{
GridPoint2 p = getHexAt(null, coords.x, coords.y);
- movePawnTo(pawn, p.x, p.y, HexOrientation.KEEP);
+ movePawnTo(pawn, p.x, p.y, Hex.Orientation.KEEP);
}
- public void setPawnAt(final Pawn pawn, final int col, final int row, HexOrientation o)
+ public void setPawnAt(final Pawn pawn, final int col, final int row, Hex.Orientation o)
{
int z = pushPawnAt(pawn, col, row);
Vector2 pos = getPawnPosAt(pawn, col, row);
pawn.pushMove(pos.x, pos.y, z, o);
}
- public void movePawnTo(final Pawn pawn, final int col, final int row, HexOrientation o)
+ public void movePawnTo(final Pawn pawn, final int col, final int row, Hex.Orientation o)
{
GridPoint2 prev = getHexAt(pawn.getLastPosition());
if (prev != null) removePawnFrom(pawn, prev.x, prev.y);
diff --git a/core/src/ch/asynk/tankontank/game/HexOrientation.java b/core/src/ch/asynk/tankontank/game/HexOrientation.java
deleted file mode 100644
index ff2b921..0000000
--- a/core/src/ch/asynk/tankontank/game/HexOrientation.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package ch.asynk.tankontank.game;
-
-public enum HexOrientation
-{
- KEEP(0),
- WEST(-90),
- NORTH_WEST(-30),
- NORTH_EAST (30),
- EAST(90),
- SOUTH_EAST(150),
- SOUTH_WEST(-150);
-
- public final int v;
- HexOrientation(int v) { this.v = v; }
-}
diff --git a/core/src/ch/asynk/tankontank/game/Pawn.java b/core/src/ch/asynk/tankontank/game/Pawn.java
index b360eaa..71e225a 100644
--- a/core/src/ch/asynk/tankontank/game/Pawn.java
+++ b/core/src/ch/asynk/tankontank/game/Pawn.java
@@ -16,7 +16,7 @@ public interface Pawn
public void moveBy(float x, float y);
- public void pushMove(float x, float y, int z, HexOrientation o);
+ public void pushMove(float x, float y, int z, Hex.Orientation o);
public void resetMoves(Runnable cb);
diff --git a/core/src/ch/asynk/tankontank/game/PawnImage.java b/core/src/ch/asynk/tankontank/game/PawnImage.java
index 9381a6d..7f06504 100644
--- a/core/src/ch/asynk/tankontank/game/PawnImage.java
+++ b/core/src/ch/asynk/tankontank/game/PawnImage.java
@@ -28,10 +28,10 @@ public class PawnImage extends Image implements Pawn
return path.getFirst();
}
- public void pushMove(float x, float y, int z, HexOrientation r)
+ public void pushMove(float x, float y, int z, Hex.Orientation r)
{
setPosition(x, y);
- if (r != HexOrientation.KEEP) setRotation(r.v);
+ if (r != Hex.Orientation.KEEP) setRotation(r.v);
setZIndex(z);
path.push(new Vector3(x, y, r.v));
}
@@ -45,7 +45,7 @@ public class PawnImage extends Image implements Pawn
while(path.size() != 0) {
Vector3 v = path.pop();
seq.addAction(Actions.moveTo(v.x, v.y, MOVE_TIME));
- if (v.z != HexOrientation.KEEP.v)
+ if (v.z != Hex.Orientation.KEEP.v)
seq.addAction(Actions.rotateTo(v.z, ROTATE_TIME));
}
diff --git a/core/src/ch/asynk/tankontank/screens/GameScreen.java b/core/src/ch/asynk/tankontank/screens/GameScreen.java
index d7e2e4a..cf946c3 100644
--- a/core/src/ch/asynk/tankontank/screens/GameScreen.java
+++ b/core/src/ch/asynk/tankontank/screens/GameScreen.java
@@ -27,7 +27,7 @@ import com.badlogic.gdx.utils.viewport.ScreenViewport;
import ch.asynk.tankontank.TankOnTank;
import ch.asynk.tankontank.game.Pawn;
import ch.asynk.tankontank.game.HexMap;
-import ch.asynk.tankontank.game.HexOrientation;
+import ch.asynk.tankontank.game.Hex;
import ch.asynk.tankontank.game.HexMapImage;
import ch.asynk.tankontank.game.HexMapFactory;
import ch.asynk.tankontank.game.Unit;
@@ -79,7 +79,7 @@ public class GameScreen extends AbstractScreen
UnitFactory.init(game.manager);
- HexOrientation o = HexOrientation.SOUTH_EAST;
+ Hex.Orientation o = Hex.Orientation.SOUTH_EAST;
addUnit(gameStage, UnitType.GE_AT_GUN, 1, 4, o);
addUnit(gameStage, UnitType.GE_INFANTRY, 2, 4, o);
addUnit(gameStage, UnitType.GE_KINGTIGER, 3, 4, o);
@@ -88,7 +88,7 @@ public class GameScreen extends AbstractScreen
addUnit(gameStage, UnitType.GE_TIGER, 6, 4, o);
addUnit(gameStage, UnitType.GE_WESPE, 7, 4, o);
- o = HexOrientation.NORTH_WEST;
+ o = Hex.Orientation.NORTH_WEST;
addUnit(gameStage, UnitType.US_AT_GUN, 1, 3, o);
addUnit(gameStage, UnitType.US_INFANTRY, 2, 3, o);
addUnit(gameStage, UnitType.US_PERSHING, 3, 3, o);
@@ -104,7 +104,7 @@ public class GameScreen extends AbstractScreen
Gdx.input.setInputProcessor(getMultiplexer());
}
- private void addUnit(Stage stage, UnitType t, int col, int row, HexOrientation o)
+ private void addUnit(Stage stage, UnitType t, int col, int row, Hex.Orientation o)
{
Unit u = UnitFactory.getUnit(t);
map.setPawnAt((Pawn) u, col, row, o);