From 74c346057fd146f01b76688f6d97827801fcd5d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Mon, 3 Nov 2014 11:51:03 +0100 Subject: BattleCommon: add entryPoints=ArrayList, and pawnEntry=HashMap --- .../asynk/tankontank/game/battles/BattleCommon.java | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/core/src/ch/asynk/tankontank/game/battles/BattleCommon.java b/core/src/ch/asynk/tankontank/game/battles/BattleCommon.java index ed7a82c..f6795b0 100644 --- a/core/src/ch/asynk/tankontank/game/battles/BattleCommon.java +++ b/core/src/ch/asynk/tankontank/game/battles/BattleCommon.java @@ -1,9 +1,15 @@ package ch.asynk.tankontank.game.battles; import java.util.Random; +import java.util.HashMap; +import java.util.ArrayList; +import ch.asynk.tankontank.engine.TileSet; import ch.asynk.tankontank.game.Army; import ch.asynk.tankontank.game.Battle; +import ch.asynk.tankontank.game.Player; +import ch.asynk.tankontank.game.Unit; +import ch.asynk.tankontank.game.Unit.UnitId; public abstract class BattleCommon implements Battle { @@ -14,6 +20,8 @@ public abstract class BattleCommon implements Battle protected Army firstArmy; protected Army secondArmy; protected Factory factory; + protected ArrayList entryPoints = new ArrayList(); + protected HashMap pawnEntry = new HashMap(); public BattleCommon(Factory factory) { @@ -40,4 +48,16 @@ public abstract class BattleCommon implements Battle secondArmy = Army.US; } } + + public void addEntryPoint(TileSet tiles) + { + entryPoints.add(tiles); + } + + public void addReinforcement(Player player, TileSet entryPoint, UnitId unitId) + { + Unit unit = factory.getUnit(unitId); + player.addReinforcement(unit); + pawnEntry.put(unit, entryPoint); + } } -- cgit v1.1-2-g2b99