zombie.ai.astar
Class AStarPathMap
java.lang.Object
zombie.ai.astar.AStarPathMap
public class AStarPathMap
- extends java.lang.Object
A path finder implementation that uses the AStar heuristic based algorithm to determine a path.
- Author:
- Kevin Glass
|
Nested Class Summary |
static class |
AStarPathMap.Node
A single node in the search graph |
|
Method Summary |
void |
DoPrecalcFile(AStarPathFinder finder)
|
int |
getFreeIndex(IsoGameCharacter character)
|
float |
getMovementCost(Mover mover,
int sx,
int sy,
int sz,
int tx,
int ty,
int tz)
get the cost to move through a given location |
AStarPathMap.Node |
getNode(int x,
int y,
int z)
|
void |
LoadPrecalcFlle()
|
void |
setNode(int x,
int y,
int z,
AStarPathMap.Node newNode)
|
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
map
public TileBasedMap map
- The map being searched
NodeMap
public java.util.ArrayList<AStarPathMap.Node> NodeMap
AStarPathMap
public AStarPathMap(TileBasedMap map)
- Create a path finder
- Parameters:
heuristic - The heuristic used to determine the search order of the mapmap - The map to be searchedmaxSearchDistance - The maximum depth we'll search before giving upallowDiagMovement - True if the search should try diaganol movement
LoadPrecalcFlle
public void LoadPrecalcFlle()
throws java.io.FileNotFoundException,
java.io.IOException
- Throws:
java.io.FileNotFoundException
java.io.IOException
DoPrecalcFile
public void DoPrecalcFile(AStarPathFinder finder)
getFreeIndex
public int getFreeIndex(IsoGameCharacter character)
getMovementCost
public float getMovementCost(Mover mover,
int sx,
int sy,
int sz,
int tx,
int ty,
int tz)
- get the cost to move through a given location
- Parameters:
mover - The entity that is being movedsx - The x coordinate of the tile whose cost is being determinedsy - The y coordiante of the tile whose cost is being determinedtx - The x coordinate of the target locationty - The y coordinate of the target location
- Returns:
- The cost of movement through the given tile
getNode
public AStarPathMap.Node getNode(int x,
int y,
int z)
setNode
public void setNode(int x,
int y,
int z,
AStarPathMap.Node newNode)