diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2014-11-18 16:31:36 +0100 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2014-11-18 16:31:36 +0100 |
commit | 809320b21a770a91489152f25670d90e9562349a (patch) | |
tree | dccbdfee137a3c8499dd029220ccd22ebd3322bb /core/src/ch/asynk/tankontank/game/battles | |
parent | 516e7dad19131e40508d2d2369e4d52714596ce7 (diff) | |
download | RustAndDust-809320b21a770a91489152f25670d90e9562349a.zip RustAndDust-809320b21a770a91489152f25670d90e9562349a.tar.gz |
Battle,BattleCommon: add Zone getExitZone(Unit unit) and add param Zone exitZone to addReinforcement(...)
Diffstat (limited to 'core/src/ch/asynk/tankontank/game/battles')
-rw-r--r-- | core/src/ch/asynk/tankontank/game/battles/BattleCommon.java | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/core/src/ch/asynk/tankontank/game/battles/BattleCommon.java b/core/src/ch/asynk/tankontank/game/battles/BattleCommon.java index f8d7555..9f97eda 100644 --- a/core/src/ch/asynk/tankontank/game/battles/BattleCommon.java +++ b/core/src/ch/asynk/tankontank/game/battles/BattleCommon.java @@ -24,6 +24,7 @@ public abstract class BattleCommon implements Battle protected ArrayList<Zone> entryZone = new ArrayList<Zone>(); protected ArrayList<Zone> exitZone = new ArrayList<Zone>(); protected HashMap<Unit, Zone> unitEntry = new HashMap<Unit, Zone>(); + protected HashMap<Unit, Zone> unitExit = new HashMap<Unit, Zone>(); protected TileSet objectives; public BattleCommon(Factory factory) @@ -57,6 +58,12 @@ public abstract class BattleCommon implements Battle return unitEntry.get(unit); } + @Override + public Zone getExitZone(Unit unit) + { + return unitExit.get(unit); + } + public void addEntryZone(Zone entry) { entryZone.add(entry); @@ -72,11 +79,23 @@ public abstract class BattleCommon implements Battle addReinforcement(player, entryZone, unitId, false); } + public void addReinforcement(Player player, Zone entryZone, Zone exitZone, UnitId unitId) + { + addReinforcement(player, entryZone, exitZone, unitId, false); + } + public void addReinforcement(Player player, Zone entryZone, UnitId unitId, boolean ace) { + addReinforcement(player, entryZone, null, unitId, ace); + } + + public void addReinforcement(Player player, Zone entryZone, Zone exitZone, UnitId unitId, boolean ace) + { Unit unit = factory.getUnit(unitId); unit.setAce(ace); player.addReinforcement(unit); unitEntry.put(unit, entryZone); + if (exitZone != null) + unitExit.put(unit, exitZone); } } |