public Vector3[] GetSolutionPath(NIPathTerrain terrain) { if (!HasSuccessfullyCompleted()) { return(null); } LinkedList <NNode> path = GetSolutionPath(); if (path == null || path.Count == 0) { return(null); } Vector3[] pathPoints = new Vector3[path.Count]; int i = 0; foreach (NNode node in path) { Vector3 nodePos = terrain.GetPathNodePos(node.Index); pathPoints[i] = nodePos; i++; } // Set the first position to be the start position pathPoints[0] = GetStartPos(); // Set the last position to be the goal position. int lastIndex = Mathf.Clamp(i, 0, path.Count - 1); System.Diagnostics.Debug.Assert(lastIndex > 1 && lastIndex < path.Count); pathPoints[lastIndex] = GetGoalPos(); return(pathPoints); }
public override void Start(NIPlanningWorld world) { base.Start(world); System.Diagnostics.Debug.Assert(world is NIPathTerrain); m_pathTerrain = world as NIPathTerrain; }
public NNavTargetGameObject(GameObject targetGameObject, NIPathTerrain pathTerrain) { m_targetGameObject = targetGameObject; m_pathTerrain = pathTerrain; }
public NNavTargetPos(Vector3 targetPos, NIPathTerrain pathTerrain) { m_targetPos = targetPos; m_pathTerrain = pathTerrain; }