diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2015-02-19 00:21:40 +0100 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2015-02-19 00:21:40 +0100 |
commit | 0db9753ccf10b06c083dd24d2c1e0b2064f9afd3 (patch) | |
tree | 72b470058e7cc75e1863aef0146290265a500e11 /core/src | |
parent | 03c6da66c658a4c222c9308a62a65ecd1c294087 (diff) | |
download | RustAndDust-0db9753ccf10b06c083dd24d2c1e0b2064f9afd3.zip RustAndDust-0db9753ccf10b06c083dd24d2c1e0b2064f9afd3.tar.gz |
Order,Command: add public abstract boolean isA(OrderType) to Order, and implement it
Diffstat (limited to 'core/src')
-rw-r--r-- | core/src/ch/asynk/tankontank/engine/Order.java | 5 | ||||
-rw-r--r-- | core/src/ch/asynk/tankontank/game/Command.java | 10 |
2 files changed, 13 insertions, 2 deletions
diff --git a/core/src/ch/asynk/tankontank/engine/Order.java b/core/src/ch/asynk/tankontank/engine/Order.java index 681bff2..47269d2 100644 --- a/core/src/ch/asynk/tankontank/engine/Order.java +++ b/core/src/ch/asynk/tankontank/engine/Order.java @@ -8,4 +8,9 @@ import com.badlogic.gdx.utils.Json; public abstract class Order implements Disposable, Pool.Poolable, Json.Serializable, Comparable<Pawn> { + public interface OrderType + { + } + + public abstract boolean isA(OrderType type); } diff --git a/core/src/ch/asynk/tankontank/game/Command.java b/core/src/ch/asynk/tankontank/game/Command.java index c310bd8..0d39e6c 100644 --- a/core/src/ch/asynk/tankontank/game/Command.java +++ b/core/src/ch/asynk/tankontank/game/Command.java @@ -8,9 +8,9 @@ import ch.asynk.tankontank.engine.Order; import ch.asynk.tankontank.engine.Move; import ch.asynk.tankontank.engine.Pawn; -public class Command extends Order +public class Command extends Order { - public enum CommandType + public enum CommandType implements Order.OrderType { NONE, MOVE, @@ -81,6 +81,12 @@ public class Command extends Order } @Override + public boolean isA(OrderType type) + { + return (type == this.type); + } + + @Override public String toString() { return String.format("%s : %s", type, unit.id); |