diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2015-02-18 11:11:45 +0100 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2015-02-18 11:11:45 +0100 |
commit | e90b60de481ffe404c49dc5b3c0716af31866d72 (patch) | |
tree | a01dd4c9713aa8052d763b94179266dc27dd4b8b /core/src | |
parent | 241251019e43daa6170c497e90688f8f104c2f20 (diff) | |
download | RustAndDust-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.java | 6 | ||||
-rw-r--r-- | core/src/ch/asynk/tankontank/engine/Pawn.java | 3 |
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) |