diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2014-10-13 01:55:08 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2014-10-13 01:55:08 +0200 |
commit | 2070da5b0cef71095a997107b79e2920dff16bd7 (patch) | |
tree | a2dd5410381a23ec2fc490c33e34ae040f911aad /core/src/ch | |
parent | 30062c1458b1cca83b91587cb2239d2378374c83 (diff) | |
download | RustAndDust-2070da5b0cef71095a997107b79e2920dff16bd7.zip RustAndDust-2070da5b0cef71095a997107b79e2920dff16bd7.tar.gz |
Board: getHexAt(Vector ... ) -> getHexUnder(Pawn ...)
Diffstat (limited to 'core/src/ch')
-rw-r--r-- | core/src/ch/asynk/tankontank/engine/Board.java | 29 |
1 files changed, 10 insertions, 19 deletions
diff --git a/core/src/ch/asynk/tankontank/engine/Board.java b/core/src/ch/asynk/tankontank/engine/Board.java index ea1fb1c..a3f449f 100644 --- a/core/src/ch/asynk/tankontank/engine/Board.java +++ b/core/src/ch/asynk/tankontank/engine/Board.java @@ -353,7 +353,7 @@ public abstract class Board implements Disposable if ((p == pawn) || !p.canAttack()) continue; if (from == null) from = gridPoint2Pool.obtain(); - getHexAt(p.getCenter(), from); + getHexUnder(p, from); if (searchBoard.canAttack(p, from.x, from.y, hex.x, hex.y)) { assists.add(from); from = null; @@ -536,13 +536,13 @@ public abstract class Board implements Disposable protected void movePawn(final Pawn pawn, int cost, ArrayList<Vector3> path, RunnableAnimation whenDone) { - removePawnFrom(pawn, getHexAt(pawn.getCenter())); + removePawnFrom(pawn, getHexUnder(pawn)); AnimationSequence seq = pawn.getMoveAnimation(path); seq.addAnimation(RunnableAnimation.get(pawn, new Runnable() { @Override public void run() { - pushPawnAt(pawn, getHexAt(pawn.getCenter())); + pushPawnAt(pawn, getHexUnder(pawn)); } })); seq.addAnimation(whenDone); @@ -564,13 +564,13 @@ public abstract class Board implements Disposable protected void revertLastPawnMove(final Pawn pawn, RunnableAnimation whenDone) { - removePawnFrom(pawn, getHexAt(pawn.getCenter())); + removePawnFrom(pawn, getHexUnder(pawn)); AnimationSequence seq = pawn.getRevertLastMoveAnimation(); seq.addAnimation(RunnableAnimation.get(pawn, new Runnable() { @Override public void run() { - pushPawnAt(pawn, getHexAt(pawn.getCenter())); + pushPawnAt(pawn, getHexUnder(pawn)); } })); seq.addAnimation(whenDone); @@ -578,27 +578,18 @@ public abstract class Board implements Disposable pawn.revertLastMove(); } - public GridPoint2 getHexAt(Vector2 v) + public GridPoint2 getHexUnder(Pawn pawn) { - if (v == null) return null; - return getHexAt(null, v.x, v.y); + return getHexAt(pawn.getCenter(), null); } - public GridPoint2 getHexAt(Vector2 v, GridPoint2 hex) - { - if (v == null) return null; - return getHexAt(hex, v.x, v.y); - } - - public GridPoint2 getHexAt(Vector3 v) + public GridPoint2 getHexUnder(Pawn pawn, GridPoint2 hex) { - if (v == null) return null; - return getHexAt(null, v.x, v.y); + return getHexAt(pawn.getCenter(), hex); } - public GridPoint2 getHexAt(Vector3 v, GridPoint2 hex) + public GridPoint2 getHexAt(Vector2 v, GridPoint2 hex) { - if (v == null) return null; return getHexAt(hex, v.x, v.y); } |