You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
55 lines
897 B
55 lines
897 B
10 years ago
|
package mightypork.rogue.world.entity;
|
||
|
|
||
|
|
||
10 years ago
|
import mightypork.gamecore.util.math.algo.Coord;
|
||
|
import mightypork.gamecore.util.math.algo.Sides;
|
||
|
import mightypork.gamecore.util.math.algo.Step;
|
||
|
import mightypork.gamecore.util.math.algo.pathfinding.Heuristic;
|
||
|
import mightypork.gamecore.util.math.algo.pathfinding.PathFinder;
|
||
10 years ago
|
|
||
|
|
||
10 years ago
|
public class EntityPathFinder extends PathFinder {
|
||
10 years ago
|
|
||
|
protected final Entity entity;
|
||
|
|
||
|
|
||
10 years ago
|
public EntityPathFinder(Entity entity)
|
||
10 years ago
|
{
|
||
10 years ago
|
this.entity = entity;
|
||
|
}
|
||
|
|
||
|
|
||
|
@Override
|
||
|
public boolean isAccessible(Coord pos)
|
||
|
{
|
||
|
return entity.getLevel().isWalkable(pos);
|
||
|
}
|
||
|
|
||
|
|
||
|
@Override
|
||
10 years ago
|
public int getCost(Coord from, Coord to) {
|
||
|
return 10;
|
||
|
}
|
||
10 years ago
|
|
||
|
|
||
|
@Override
|
||
10 years ago
|
public int getMinCost() {
|
||
|
return 10;
|
||
|
}
|
||
10 years ago
|
|
||
|
|
||
|
@Override
|
||
|
public Heuristic getHeuristic()
|
||
|
{
|
||
|
return PathFinder.DIAGONAL_HEURISTIC;
|
||
|
}
|
||
|
|
||
|
|
||
|
@Override
|
||
10 years ago
|
public Step[] getWalkSides()
|
||
10 years ago
|
{
|
||
10 years ago
|
return Sides.CARDINAL_SIDES;
|
||
10 years ago
|
}
|
||
|
|
||
|
}
|