Package nz.ac.vuw.ecs.swen225.gp6.domain
Class Level
java.lang.Object
nz.ac.vuw.ecs.swen225.gp6.domain.Level
The level class is used to group all information related to a level together. Such as the maze,
inventory, direction of players next movement, etc.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionconstructor for a level, which takes the maze, and level number.constructor for a level which takes, maze, inventory, level number, time limit of level, current time of level, and heros next steps direction. -
Method Summary
Modifier and TypeMethodDescriptionlongGet the current time of the level.Get the direction of the hero's next step.voidsets the movement direction of hero, which the hero will try to move towards if possible in NEXT ping.voidsetCurrentTime(long timeCurrent) sets the current time of the level.
-
Field Details
-
maze
-
inv
-
lvl
public final int lvl -
timeLimit
public final int timeLimit
-
-
Constructor Details
-
Level
public Level(Maze maze, Inventory inv, int lvl, int timeLimit, long timeCurrent, Direction heroNextStep) constructor for a level which takes, maze, inventory, level number, time limit of level, current time of level, and heros next steps direction.- Parameters:
maze- - the mazeinv- - the inventorylvl- - the level number 1,2, ...timeLimit- - in seconds, the limit for how long the player has to finish the leveltimeCurrent- - the current time in seconds (should start at 0)heroNextStep- - the hero's direction of stepping in next ping- Throws:
NullPointerException- if maze, inventory, or direction are nullIndexOutOfBoundsException- if level is less than 1 or the times are less than 0
-
Level
constructor for a level, which takes the maze, and level number. It default the time limit to 120 s, and the current time to 0 s, inventory to an empty inventory of size 8 and heros direction to None.- Parameters:
maze- - the maze of the levellvl- - the level number 1,2, ...
-
-
Method Details
-
getCurrentTime
public long getCurrentTime()Get the current time of the level.- Returns:
- current time on level
-
setCurrentTime
public void setCurrentTime(long timeCurrent) sets the current time of the level.- Parameters:
timeCurrent- - the time to set the level's time to- Throws:
IllegalArgumentException- if timeCurrent is negative
-
getHeroNextStep
Get the direction of the hero's next step.- Returns:
- direction enum for next step of hero
-
makeHeroStep
sets the movement direction of hero, which the hero will try to move towards if possible in NEXT ping.- Parameters:
d- - the direction for hero to step in next unit of time
-