Example #1
0
 public static void limitPathByMaximumPathCost(ref NavigationPath p_navigationPath, float p_maxPathCost)
 {
     if (p_maxPathCost >= 0.00f)
     {
         int l_lastIndex = -1;
         for (int i = 0; i < p_navigationPath.NavigationNodes.Count; i++)
         {
             NavigationNode l_navigationNode      = p_navigationPath.NavigationNodes[i];
             float          l_calculatedpathScore = p_navigationPath.NavigationNodesTraversalCalculations[l_navigationNode].PathScore;
             if (l_calculatedpathScore > p_maxPathCost)
             {
                 if (l_lastIndex <= 0)
                 {
                     p_navigationPath.NavigationNodes.Clear();
                     p_navigationPath.PathCost = 0.0f;
                 }
                 else
                 {
                     p_navigationPath.NavigationNodes.RemoveRange(i, p_navigationPath.NavigationNodes.Count - i);
                     p_navigationPath.PathCost = p_navigationPath.NavigationNodesTraversalCalculations[p_navigationPath.NavigationNodes[i - 1]].PathScore;
                 }
                 return;
             }
             l_lastIndex = i;
         }
     }
 }
Example #2
0
 public void ClearForNewInstance()
 {
     NavigationGraph = null;
     BeginNode       = null;
     EndNode         = null;
     NodesElligibleForNextCurrent.Clear();
     NavigationPath.reset(ref ResultPath);
 }
Example #3
0
            public static CalculatePathRequest alloc()
            {
                CalculatePathRequest l_instance = new CalculatePathRequest();

                l_instance.NodesElligibleForNextCurrent = new List <NavigationNode>();
                l_instance.ResultPath = NavigationPath.build(new List <NavigationNode>(), new Dictionary <NavigationNode, NavigationNodePathTraversalCalculations>());
                return(l_instance);
            }
Example #4
0
        public NavigationPath Clone()
        {
            NavigationPath l_instance = new NavigationPath();

            l_instance.NavigationNodes = new List <NavigationNode>(NavigationNodes);
            l_instance.NavigationNodesTraversalCalculations = new Dictionary <NavigationNode, NavigationNodePathTraversalCalculations>(NavigationNodesTraversalCalculations);
            l_instance.PathCost = PathCost;
            return(l_instance);
        }
Example #5
0
        public static NavigationPath build(List <NavigationNode> p_navigationNodes, Dictionary <NavigationNode, NavigationNodePathTraversalCalculations> p_calculations)
        {
            NavigationPath l_instance = new NavigationPath();

            l_instance.NavigationNodes = p_navigationNodes;
            l_instance.NavigationNodesTraversalCalculations = p_calculations;
            l_instance.PathCost = 0.0f;
            return(l_instance);
        }
Example #6
0
 public static void reset(ref NavigationPath p_navigationPath)
 {
     p_navigationPath.NavigationNodes.Clear();
     p_navigationPath.NavigationNodesTraversalCalculations.Clear();
     p_navigationPath.PathCost = 0.0f;
 }