for the NavMesh, how would you find the closest waypoint to the player’s current position?
static bool FindClosestEdge(Vector3 sourcePosition, NavMeshHit hit, int passableMask);
http://docs.unity3d.com/ScriptReference/NavMesh.html
Honestly buddy… is it so hard to just google, it took me all of 14 seconds.