Serializable
, Comparable<Controller.Action>
@Immutable public static enum Controller.Action extends Enum<Controller.Action>
Enum Constant | Description |
---|---|
DUCK |
A duck, which will decrease a player's height.
|
EAT_LEFT |
The action of eating the food in the player's left hand.
|
EAT_RIGHT |
The action of eating the food in the player's right hand.
|
MOVE_BACKWARD |
A movement in the backward direction.
|
MOVE_FORWARD |
A movement in the direction that a player is facing.
|
PICKUP_LEFT |
A pickup of a piece of food into the player's left hand.
|
PICKUP_RIGHT |
A pickup of a piece of food into the player's right hand.
|
THROW_LEFT |
A throw from the player's left hand.
|
THROW_RIGHT |
A throw from the player's right hand.
|
TURN_LEFT |
A turn in the counter-clockwise direction.
|
TURN_RIGHT |
A turn in the clockwise direction.
|
Modifier and Type | Method | Description |
---|---|---|
boolean |
isEating() |
Determines whether this action is one of the "eat" actions.
|
boolean |
isMoving() |
Determines whether this action is one of the "move" actions.
|
boolean |
isPickingUp() |
Determines whether this action is one of the "pickup" actions.
|
boolean |
isThrowing() |
Determines whether this action is one of the "throw" actions.
|
boolean |
isTurning() |
Determines whether this action is one of the "turn" actions.
|
String |
toString() |
Returns a human-readable name for this action that differs from what
will be returned by
Enum.name() . |
static Controller.Action |
valueOf(String name) |
Returns the enum constant of this type with the specified name.
|
static Controller.Action[] |
values() |
Returns an array containing the constants of this enum type, in
the order they are declared.
|
@SerializedName("moveForward") public static final Controller.Action MOVE_FORWARD
@SerializedName("moveBackward") public static final Controller.Action MOVE_BACKWARD
@SerializedName("turnLeft") public static final Controller.Action TURN_LEFT
@SerializedName("turnRight") public static final Controller.Action TURN_RIGHT
@SerializedName("duck") public static final Controller.Action DUCK
@SerializedName("pickupLeft") public static final Controller.Action PICKUP_LEFT
@SerializedName("pickupRight") public static final Controller.Action PICKUP_RIGHT
@SerializedName("throwLeft") public static final Controller.Action THROW_LEFT
@SerializedName("throwRight") public static final Controller.Action THROW_RIGHT
@SerializedName("eatLeft") public static final Controller.Action EAT_LEFT
@SerializedName("eatRight") public static final Controller.Action EAT_RIGHT
public static Controller.Action[] values()
for (Controller.Action c : Controller.Action.values()) System.out.println(c);
public static Controller.Action valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullpublic String toString()
Enum.name()
. It will be a bit more readable
by human eyes, and is intended primarily for debugging purposes.toString
in class Enum<Controller.Action>
public boolean isMoving()
MOVE_FORWARD
and MOVE_BACKWARD
.public boolean isTurning()
TURN_LEFT
and TURN_RIGHT
.public boolean isPickingUp()
PICKUP_LEFT
and
PICKUP_RIGHT
.public boolean isThrowing()
THROW_LEFT
and THROW_RIGHT
.