44 lines
747 B
Plaintext
44 lines
747 B
Plaintext
// Useful to sort lists by a custom key
|
|
import java.util.Comparator;
|
|
|
|
|
|
/// In this file you will implement your navmesh and pathfinding.
|
|
|
|
/// This node representation is just a suggestion
|
|
class Node
|
|
{
|
|
int id;
|
|
ArrayList<Wall> polygon;
|
|
PVector center;
|
|
ArrayList<Node> neighbors;
|
|
ArrayList<Wall> connections;
|
|
}
|
|
|
|
|
|
|
|
class NavMesh
|
|
{
|
|
void bake(Map map)
|
|
{
|
|
/// generate the graph you need for pathfinding
|
|
}
|
|
|
|
ArrayList<PVector> findPath(PVector start, PVector destination)
|
|
{
|
|
/// implement A* to find a path
|
|
ArrayList<PVector> result = null;
|
|
return result;
|
|
}
|
|
|
|
|
|
void update(float dt)
|
|
{
|
|
draw();
|
|
}
|
|
|
|
void draw()
|
|
{
|
|
/// use this to draw the nav mesh graph
|
|
}
|
|
}
|