JavaScript is disabled on your browser.
All Implemented Interfaces:
Serializable
, Comparable <Behaviour >
, Constable
Behaviour
defines the different behaviour which a ghost can be in. The behaviour are defined
as "CHASE", "SCATTER", "FRIGHTENED" and "INACTIVE".
"CHASE" - Behaviour where the ghosts chase Pacman. Has a duration of 20.
"FRIGHTENED" - Behaviour where the ghosts are frightened and confused.
It has a duration of 30.
"SCATTER" - Behaviour where the ghosts run home (scatter position). IT has a duration of 10.
"INACTIVE" - Behaviour where the ghosts don't do anything and Pacman cannot kill them.
Enum Constant Summary
Enum Constants
Behaviour where the ghosts chase Pacman.
Behaviour where the ghosts are frightened and confused.
Behaviour where the ghosts don't do anything and Pacman cannot kill them.
Behaviour where the ghosts run home (scatter position).
Field Summary
Fields
private final int
Stores the duration of the behaviour.
Constructor Summary
Constructors
private
Constructor with arguments.
Method Summary
All Methods Static Methods Instance Methods Concrete Methods
int
Gets the duration of the behaviour.
Returns a String with information of the Behaviour.
Returns the enum constant of this class with the specified name.
Returns an array containing the constants of this enum class, in
the order they are declared.
Enum Constant Details
CHASE
Behaviour where the ghosts chase Pacman. Has a duration of 20
FRIGHTENED
Behaviour where the ghosts are frightened and confused. It has a duration of 30
SCATTER
Behaviour where the ghosts run home (scatter position). IT has a duration of 10.
INACTIVE
Behaviour where the ghosts don't do anything and Pacman cannot kill them.
Field Details
duration
private final int duration
Stores the duration of the behaviour.
Constructor Details
Behaviour
private Behaviour (int duration)
Constructor with arguments.
Parameters:
duration
- Value to set to the behaviour.
Method Details
values
Returns an array containing the constants of this enum class, in
the order they are declared.
Returns:
an array containing the constants of this enum class, in the order they are declared
valueOf
Returns the enum constant of this class with the specified name.
The string must match exactly an identifier used to declare an
enum constant in this class. (Extraneous whitespace characters are
not permitted.)
Parameters:
name
- the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
IllegalArgumentException
- if this enum class has no constant with the specified name
NullPointerException
- if the argument is null
getDuration
public int getDuration ()
Gets the duration of the behaviour.
Returns:
duration of the behaviour.
toString
Returns a String with information of the Behaviour.
Format: BEHAVIOUR:behaviourDuration
Example: "CHASE:20"
Hint: Remember that toString() is already coded in Object.
Overrides:
toString
in class Enum <Behaviour >
Returns:
BEHAVIOUR:behaviourDuration