diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2014-09-18 16:45:37 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2014-09-18 16:45:37 +0200 |
commit | 127dd3f7518ada1598adc176585ee7151d4ba7be (patch) | |
tree | 75f8fa0b5a5c07cfcfbc51b361934dc21d201a13 /core/src/ch/asynk | |
parent | 3f72675a5048dd9b47e8cef80fd07ed5e4aeaa10 (diff) | |
download | RustAndDust-127dd3f7518ada1598adc176585ee7151d4ba7be.zip RustAndDust-127dd3f7518ada1598adc176585ee7151d4ba7be.tar.gz |
Tile.Orientation -> Pawn.Orientation
Diffstat (limited to 'core/src/ch/asynk')
-rw-r--r-- | core/src/ch/asynk/tankontank/engine/Map.java | 4 | ||||
-rw-r--r-- | core/src/ch/asynk/tankontank/engine/MapImage.java | 6 | ||||
-rw-r--r-- | core/src/ch/asynk/tankontank/engine/Pawn.java | 16 | ||||
-rw-r--r-- | core/src/ch/asynk/tankontank/engine/PawnImage.java | 6 | ||||
-rw-r--r-- | core/src/ch/asynk/tankontank/engine/Tile.java | 12 | ||||
-rw-r--r-- | core/src/ch/asynk/tankontank/screens/GameScreen.java | 6 |
6 files changed, 26 insertions, 24 deletions
diff --git a/core/src/ch/asynk/tankontank/engine/Map.java b/core/src/ch/asynk/tankontank/engine/Map.java index e221fe8..771e2c9 100644 --- a/core/src/ch/asynk/tankontank/engine/Map.java +++ b/core/src/ch/asynk/tankontank/engine/Map.java @@ -23,9 +23,9 @@ public interface Map public void movePawnTo(Pawn pawn, Vector3 coords); - public void setPawnAt(Pawn pawn, int col, int row, Tile.Orientation o); + public void setPawnAt(Pawn pawn, int col, int row, Pawn.Orientation o); - public void movePawnTo(Pawn pawn, int col, int row, Tile.Orientation o); + public void movePawnTo(Pawn pawn, int col, int row, Pawn.Orientation o); public class Config { diff --git a/core/src/ch/asynk/tankontank/engine/MapImage.java b/core/src/ch/asynk/tankontank/engine/MapImage.java index b016852..2b80974 100644 --- a/core/src/ch/asynk/tankontank/engine/MapImage.java +++ b/core/src/ch/asynk/tankontank/engine/MapImage.java @@ -73,17 +73,17 @@ public class MapImage extends Image implements Map public void movePawnTo(Pawn pawn, Vector3 coords) { GridPoint2 p = getHexAt(null, coords.x, coords.y); - movePawnTo(pawn, p.x, p.y, Tile.Orientation.KEEP); + movePawnTo(pawn, p.x, p.y, Pawn.Orientation.KEEP); } - public void setPawnAt(final Pawn pawn, final int col, final int row, Tile.Orientation o) + public void setPawnAt(final Pawn pawn, final int col, final int row, Pawn.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, Tile.Orientation o) + public void movePawnTo(final Pawn pawn, final int col, final int row, Pawn.Orientation o) { GridPoint2 prev = getHexAt(pawn.getLastPosition()); // if (prev == null) throw new (); diff --git a/core/src/ch/asynk/tankontank/engine/Pawn.java b/core/src/ch/asynk/tankontank/engine/Pawn.java index 969e1e9..bcd1966 100644 --- a/core/src/ch/asynk/tankontank/engine/Pawn.java +++ b/core/src/ch/asynk/tankontank/engine/Pawn.java @@ -16,9 +16,23 @@ public interface Pawn public void moveBy(float x, float y); - public void pushMove(float x, float y, int z, Tile.Orientation o); + public void pushMove(float x, float y, int z, Pawn.Orientation o); public void resetMoves(Runnable cb); public void moveDone(); + + 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/engine/PawnImage.java b/core/src/ch/asynk/tankontank/engine/PawnImage.java index acb09a9..d092028 100644 --- a/core/src/ch/asynk/tankontank/engine/PawnImage.java +++ b/core/src/ch/asynk/tankontank/engine/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, Tile.Orientation r) + public void pushMove(float x, float y, int z, Pawn.Orientation r) { setPosition(x, y); - if (r != Tile.Orientation.KEEP) setRotation(r.v); + if (r != Pawn.Orientation.KEEP) setRotation(r.v); setZIndex(z); Vector3 v = new Vector3(x, y, r.v); if ((path.size() == 0) || (!v.equals(path.getFirst()))) @@ -47,7 +47,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 != Tile.Orientation.KEEP.v) + if (v.z != Pawn.Orientation.KEEP.v) seq.addAction(Actions.rotateTo(v.z, ROTATE_TIME)); } diff --git a/core/src/ch/asynk/tankontank/engine/Tile.java b/core/src/ch/asynk/tankontank/engine/Tile.java index eaaaf24..3bbf22f 100644 --- a/core/src/ch/asynk/tankontank/engine/Tile.java +++ b/core/src/ch/asynk/tankontank/engine/Tile.java @@ -12,19 +12,7 @@ public interface Tile public int costFrom(Side side); - 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; } - } public enum Side { diff --git a/core/src/ch/asynk/tankontank/screens/GameScreen.java b/core/src/ch/asynk/tankontank/screens/GameScreen.java index 765fae2..72a558e 100644 --- a/core/src/ch/asynk/tankontank/screens/GameScreen.java +++ b/core/src/ch/asynk/tankontank/screens/GameScreen.java @@ -85,7 +85,7 @@ public class GameScreen implements Screen gameStage.addActor(selectedHex); - Tile.Orientation o = Tile.Orientation.SOUTH_EAST; + Pawn.Orientation o = Pawn.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); @@ -94,7 +94,7 @@ public class GameScreen implements Screen addUnit(gameStage, UnitType.GE_TIGER, 6, 4, o); addUnit(gameStage, UnitType.GE_WESPE, 7, 4, o); - o = Tile.Orientation.NORTH_WEST; + o = Pawn.Orientation.NORTH_EAST; 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); @@ -110,7 +110,7 @@ public class GameScreen implements Screen Gdx.input.setInputProcessor(getMultiplexer()); } - private void addUnit(Stage stage, UnitType t, int col, int row, Tile.Orientation o) + private void addUnit(Stage stage, UnitType t, int col, int row, Pawn.Orientation o) { PawnImage p = GameFactory.getUnit(t); map.setPawnAt(p, col, row, o); |