public class RegionGoal extends java.lang.Object implements AStarGoalBase<AStarRegionNode>
Constructor and Description |
---|
RegionGoal() |
Modifier and Type | Method and Description |
---|---|
int |
distanceToGoal(int startX,
int startY,
int startZ)
The heuristic function used by the A* algorithm to judge the cost of a
node.
|
int |
getNodeCost(AStarRegionNode from,
int toX,
int toY,
int toZ)
Returns the actual cost accurately, for moving from node
from
to the given set of coordinates. |
boolean |
isPathFinished(AStarRegionNode currentNode)
Returns if the given node corresponds to the goal tile on the map.
|
void |
setGoalNode(AStarRegionNode goal) |
void |
setMaximumRevolutions(int maximum)
Sets the number of revolutions the A* search algorithm may execute, before
the goal declares the search unsuccessful.
|
void |
setNodeStorage(AStarOpenListBase<AStarRegionNode> openList)
Tells the goal about the used storage containers.
|
boolean |
shouldGiveUp(int currentRevolutions)
Returns if the taken search revolutions exceed the set maximum.
|
public int distanceToGoal(int startX, int startY, int startZ)
AStarGoalBase
distanceToGoal
in interface AStarGoalBase<AStarRegionNode>
public int getNodeCost(AStarRegionNode from, int toX, int toY, int toZ)
AStarGoalBase
from
to the given set of coordinates. It is assumed that these are adjacent.getNodeCost
in interface AStarGoalBase<AStarRegionNode>
from
- Start node of movement.toX
- X-position of destination.toY
- Y-position of destination.toZ
- Z-position of destination.public boolean isPathFinished(AStarRegionNode currentNode)
AStarGoalBase
isPathFinished
in interface AStarGoalBase<AStarRegionNode>
currentNode
- The node to check for corresponding to the goal tile.true
if the node's tile is the goal,
false
otherwise.public void setGoalNode(AStarRegionNode goal)
setGoalNode
in interface AStarGoalBase<AStarRegionNode>
public void setMaximumRevolutions(int maximum)
AStarGoalBase
setMaximumRevolutions
in interface AStarGoalBase<AStarRegionNode>
maximum
- The number of revolutions.public void setNodeStorage(AStarOpenListBase<AStarRegionNode> openList)
AStarGoalBase
setNodeStorage
in interface AStarGoalBase<AStarRegionNode>
public boolean shouldGiveUp(int currentRevolutions)
AStarGoalBase
shouldGiveUp
in interface AStarGoalBase<AStarRegionNode>
currentRevolutions
- Number of revolutions the search has already
taken.true
if the search should be ended, false
otherwise.