Example #1
0
        //maps lowest values from the start node to all other nodes
        public void FloodProximity(sFloodProximityArgs Args)
        {
            PathfinderNode CurrentNode = default(PathfinderNode);
            PathfinderNode ConnectedNode = default(PathfinderNode);
            int A = 0;
            int SourceNodeCount = 0;
            int SourceNodeNum = 0;
            PathfinderConnection tmpConnection = default(PathfinderConnection);
            float ResultValue = 0;
            PathfinderNode StartNode = default(PathfinderNode);

            StartNode = Args.StartNode;

            NetworkLargeArrays.Nodes_Nodes[0] = StartNode;
            SourceNodeCount = 1;
            Args.NodeValues[StartNode.Layer_NodeNum] = 0.0F;

            SourceNodeNum = 0;
            while ( SourceNodeNum < SourceNodeCount )
            {
                CurrentNode = NetworkLargeArrays.Nodes_Nodes[SourceNodeNum];
                for ( A = 0; A <= CurrentNode.ConnectionCount - 1; A++ )
                {
                    tmpConnection = CurrentNode.Connections[A];
                    ConnectedNode = tmpConnection.GetOtherNode(CurrentNode);
                    ResultValue = Args.NodeValues[CurrentNode.Layer_NodeNum] + tmpConnection.Value;
                    if ( ResultValue < Args.NodeValues[ConnectedNode.Layer_NodeNum] )
                    {
                        Args.NodeValues[ConnectedNode.Layer_NodeNum] = ResultValue;
                        NetworkLargeArrays.Nodes_Nodes[SourceNodeCount] = ConnectedNode;
                        SourceNodeCount++;
                    }
                }
                SourceNodeNum++;
            }
        }
Example #2
0
 public void FloodProximity(ref sFloodProximityArgs Args)
 {
     PathfinderNode startNode = Args.StartNode;
     this.NetworkLargeArrays.Nodes_Nodes[0] = startNode;
     int index = 1;
     Args.NodeValues[startNode.Layer_NodeNum] = 0f;
     for (int i = 0; i < index; i++)
     {
         PathfinderNode self = this.NetworkLargeArrays.Nodes_Nodes[i];
         int num5 = self.ConnectionCount - 1;
         for (int j = 0; j <= num5; j++)
         {
             PathfinderConnection connection = self.Connections[j];
             PathfinderNode otherNode = connection.GetOtherNode(self);
             float num2 = Args.NodeValues[self.Layer_NodeNum] + connection.Value;
             if (num2 < Args.NodeValues[otherNode.Layer_NodeNum])
             {
                 Args.NodeValues[otherNode.Layer_NodeNum] = num2;
                 this.NetworkLargeArrays.Nodes_Nodes[index] = otherNode;
                 index++;
             }
         }
     }
 }