summaryrefslogtreecommitdiffstats
path: root/core/src
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2015-02-18 11:11:45 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2015-02-18 11:11:45 +0100
commite90b60de481ffe404c49dc5b3c0716af31866d72 (patch)
treea01dd4c9713aa8052d763b94179266dc27dd4b8b /core/src
parent241251019e43daa6170c497e90688f8f104c2f20 (diff)
downloadRustAndDust-e90b60de481ffe404c49dc5b3c0716af31866d72.zip
RustAndDust-e90b60de481ffe404c49dc5b3c0716af31866d72.tar.gz
Attack: set (Pawn attacker) constructor parameter
Diffstat (limited to 'core/src')
-rw-r--r--core/src/ch/asynk/tankontank/engine/Attack.java6
-rw-r--r--core/src/ch/asynk/tankontank/engine/Pawn.java3
2 files changed, 6 insertions, 3 deletions
diff --git a/core/src/ch/asynk/tankontank/engine/Attack.java b/core/src/ch/asynk/tankontank/engine/Attack.java
index 6bdc9af..bc99b67 100644
--- a/core/src/ch/asynk/tankontank/engine/Attack.java
+++ b/core/src/ch/asynk/tankontank/engine/Attack.java
@@ -8,6 +8,11 @@ public class Attack
public boolean isClear;
public boolean isFlank;
+ public Attack(Pawn attacker)
+ {
+ this.attacker = attacker;
+ }
+
public String toString()
{
return String.format("attack : %s -> %s dist:%d clear:%b flank:%b", attacker, target, distance, isClear, isFlank);
@@ -15,7 +20,6 @@ public class Attack
public void reset()
{
- attacker = null;
target = null;
distance = 0;;
isClear = false;
diff --git a/core/src/ch/asynk/tankontank/engine/Pawn.java b/core/src/ch/asynk/tankontank/engine/Pawn.java
index 00965b3..716b66b 100644
--- a/core/src/ch/asynk/tankontank/engine/Pawn.java
+++ b/core/src/ch/asynk/tankontank/engine/Pawn.java
@@ -73,8 +73,7 @@ public abstract class Pawn implements Moveable, Disposable
this.prevTile = null;
this.position = new Vector3(0f, 0f, 0f);
this.prevPosition = new Vector3(0f, 0f, 0f);
- this.attack = new Attack();
- this.attack.attacker = this;
+ this.attack = new Attack(this);
}
public Pawn(Faction faction, String name, TextureAtlas pawns, TextureAtlas overlays)