From c4fd1a79b9cc2a27448c7631cbd46f701115c8e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Fri, 3 Oct 2014 11:45:40 +0200 Subject: Map: add movePawn(Pawn pawn, Orientation o) --- core/src/ch/asynk/tankontank/game/Map.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/core/src/ch/asynk/tankontank/game/Map.java b/core/src/ch/asynk/tankontank/game/Map.java index 2c2e775..d8458f1 100644 --- a/core/src/ch/asynk/tankontank/game/Map.java +++ b/core/src/ch/asynk/tankontank/game/Map.java @@ -6,14 +6,17 @@ import java.util.HashSet; import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.g2d.TextureAtlas; import com.badlogic.gdx.math.Vector2; +import com.badlogic.gdx.math.Vector3; import com.badlogic.gdx.math.GridPoint2; import com.badlogic.gdx.graphics.glutils.ShapeRenderer; -import ch.asynk.tankontank.engine.Board; import ch.asynk.tankontank.engine.Pawn; +import ch.asynk.tankontank.engine.Board; +import ch.asynk.tankontank.engine.Orientation; public abstract class Map extends Board { + private final Vector finalPath = new Vector(10); private final Vector possibleMoves = new Vector(20); private final Vector possibleTargets = new Vector(10); private final HashSet possiblePaths = new HashSet(10); @@ -99,6 +102,14 @@ public abstract class Map extends Board return possiblePathsFilterToggle(hex, possiblePaths); } + public void movePawn(Pawn pawn, Orientation o) + { + int s = getFinalPath(pawn, finalPath, o); + if (s > 0) { + movePawn(pawn, finalPath); + } + } + public void clearPossibles() { enablePossibleMoves(false); -- cgit v1.1-2-g2b99