Class Path
java.lang.Object
zombie.ai.astar.Path
A path determined by some path finding algorithm. A series of steps from
the starting location to the target location. This includes a step for the
initial location.
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
appendStep
(int x, int y, int z) Append a step to the path.boolean
contains
(int x, int y, int z) float
static Path.Step
int
get the length of the path, i.e.getStep
(int index) get the step at a given index in the pathint
getX
(int index) get the x coordinate for the step at the given indexint
getY
(int index) get the y coordinate for the step at the given indexint
getZ
(int index) void
prependStep
(int x, int y, int z) Prepend a step to the path.
-
Field Details
-
cost
public float cost -
stepstore
-
-
Constructor Details
-
Path
public Path()
-
-
Method Details
-
costPerStep
public float costPerStep() -
appendStep
public void appendStep(int x, int y, int z) Append a step to the path.- Parameters:
x
- The x coordinate of the new stepy
- The y coordinate of the new stepz
-
-
contains
public boolean contains(int x, int y, int z) -
getLength
public int getLength()get the length of the path, i.e. the number of steps- Returns:
- The number of steps in this path
-
getStep
get the step at a given index in the path- Parameters:
index
- The index of the step to retrieve. Note this should be >= 0 and invalid input: '<' getLength();- Returns:
- The step information, the position on the map.
-
getX
public int getX(int index) get the x coordinate for the step at the given index- Parameters:
index
- The index of the step whose x coordinate should be retrieved- Returns:
- The x coordinate at the step
-
getY
public int getY(int index) get the y coordinate for the step at the given index- Parameters:
index
- The index of the step whose y coordinate should be retrieved- Returns:
- The y coordinate at the step
-
getZ
public int getZ(int index) -
createStep
-
prependStep
public void prependStep(int x, int y, int z) Prepend a step to the path.- Parameters:
x
- The x coordinate of the new stepy
- The y coordinate of the new stepz
-
-