summaryrefslogtreecommitdiffstats
path: root/core/src/ch/asynk/tankontank/game/Unit.java
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/ch/asynk/tankontank/game/Unit.java')
-rw-r--r--core/src/ch/asynk/tankontank/game/Unit.java23
1 files changed, 5 insertions, 18 deletions
diff --git a/core/src/ch/asynk/tankontank/game/Unit.java b/core/src/ch/asynk/tankontank/game/Unit.java
index c33e721..ce652b2 100644
--- a/core/src/ch/asynk/tankontank/game/Unit.java
+++ b/core/src/ch/asynk/tankontank/game/Unit.java
@@ -3,6 +3,7 @@ package ch.asynk.tankontank.game;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
+import ch.asynk.tankontank.engine.Army;
import ch.asynk.tankontank.engine.Pawn;
import ch.asynk.tankontank.engine.Tile;
import ch.asynk.tankontank.engine.HeadedPawn;
@@ -51,20 +52,18 @@ public class Unit extends HeadedPawn
public int mp;
public UnitType type;
public UnitId id;
- public Army army;
private boolean hasMoved;
private boolean hasFired;
- protected Unit(TextureAtlas atlas, String pawn, String head)
+ protected Unit(Army army, TextureAtlas atlas, String pawn, String head)
{
- super(atlas, pawn, head);
+ super(army, atlas, pawn, head);
}
// hard tager
public Unit(Army army, UnitId id, UnitType type, int range, int defense, int movementPoints, TextureAtlas atlas, String unit, String head)
{
- super(atlas, unit, head);
- this.army = army;
+ super(army, atlas, unit, head);
this.rng = range;
this.def = defense;
this.mp = movementPoints;
@@ -78,8 +77,7 @@ public class Unit extends HeadedPawn
// soft tager
public Unit(Army army, UnitId id, UnitType type, int range, int defense, int concealedDefense, int movementPoints, TextureAtlas atlas, String unit, String head)
{
- super(atlas, unit, head);
- this.army = army;
+ super(army, atlas, unit, head);
this.rng = range;
this.def = defense;
this.cdef = concealedDefense;
@@ -91,11 +89,6 @@ public class Unit extends HeadedPawn
this.descr = id.toString() + " (" + rng + "-" + def + "/" + cdef + "-" + mp + ")";
}
- public boolean isEnemy(Army other)
- {
- return army.isEnemy(other);
- }
-
@Override
public int getMovementPoints()
{
@@ -150,12 +143,6 @@ public class Unit extends HeadedPawn
}
@Override
- public boolean isEnemy(Pawn other)
- {
- return army.isEnemy(((Unit) other).army);
- }
-
- @Override
public boolean canRotate()
{
if (type == UnitType.HARD_TARGET) return !hasMoved;