Example #1
0
 public PathfinderNode(PathfinderLayer NewParentLayer)
 {
     this.Network_FindParentNum = -1;
     this.Layer_NodeNum = -1;
     this.Layer_ChangedNodeNum = -1;
     this.ParentNode_NodeNum = -1;
     this.Nodes = new PathfinderNode[4];
     this.Connections = new PathfinderConnection[2];
     this.Clearance = 0x7fffffff;
     this.Layer = NewParentLayer;
     this.Layer.Node_Add(this);
 }
Example #2
0
 public PathfinderNode(PathfinderNetwork ParentNetwork)
 {
     PathfinderLayer layer;
     this.Network_FindParentNum = -1;
     this.Layer_NodeNum = -1;
     this.Layer_ChangedNodeNum = -1;
     this.ParentNode_NodeNum = -1;
     this.Nodes = new PathfinderNode[4];
     this.Connections = new PathfinderConnection[2];
     this.Clearance = 0x7fffffff;
     if (ParentNetwork.NodeLayerCount == 0)
     {
         layer = new PathfinderLayer(ParentNetwork);
     }
     else
     {
         layer = ParentNetwork.NodeLayers[0];
     }
     this.Layer = layer;
     layer.Node_Add(this);
 }
Example #3
0
 public void ForceDeallocate()
 {
     int num2 = this.NodeCount - 1;
     for (int i = 0; i <= num2; i++)
     {
         this.Nodes[i].ForceDeallocate();
     }
     this.Nodes = null;
     this.Connections = null;
     this.Network = null;
     this.ParentLayer = null;
 }
Example #4
0
 public void FindParent()
 {
     PathfinderNode nodeToAdd = null;
     if ((this.NodeCount == 0) & (this.Layer.Network_LayerNum > 0))
     {
         Debugger.Break();
     }
     else if (this.ParentNode != null)
     {
         Debugger.Break();
     }
     else
     {
         bool flag2;
         float maxValue = float.MaxValue;
         int num7 = this.ConnectionCount - 1;
         for (int i = 0; i <= num7; i++)
         {
             bool flag;
             float num6;
             PathfinderConnection connection = this.Connections[i];
             PathfinderNode otherNode = connection.GetOtherNode(this);
             PathfinderNode parentNode = otherNode.ParentNode;
             if (parentNode == null)
             {
                 parentNode = connection.GetOtherNode(this);
                 num6 = connection.Value * (0.98f + (VBMath.Rnd() * 0.04f));
                 if (num6 < maxValue)
                 {
                     maxValue = num6;
                     nodeToAdd = parentNode;
                     flag2 = true;
                 }
                 continue;
             }
             if (parentNode.NodeCount == 3)
             {
                 int num5 = 0;
                 flag = false;
                 int num8 = parentNode.NodeCount - 1;
                 for (int j = 0; j <= num8; j++)
                 {
                     int num9 = parentNode.Nodes[j].ConnectionCount - 1;
                     for (int k = 0; k <= num9; k++)
                     {
                         if (parentNode.Nodes[j].Connections[k].GetOtherNode(parentNode.Nodes[j]) == this)
                         {
                             num5++;
                             if (num5 >= 2)
                             {
                                 flag = true;
                             }
                             break;
                         }
                     }
                 }
             }
             else
             {
                 flag = true;
             }
             if (flag)
             {
                 num6 = (otherNode.SiblingSpan + connection.Value) * (0.98f + (VBMath.Rnd() * 0.04f));
                 if (num6 < maxValue)
                 {
                     maxValue = num6;
                     nodeToAdd = parentNode;
                     flag2 = false;
                 }
             }
         }
         if (nodeToAdd != null)
         {
             if (flag2)
             {
                 PathfinderLayer parentLayer;
                 if (this.Layer.ParentLayer == null)
                 {
                     parentLayer = new PathfinderLayer(this.Layer.Network);
                 }
                 else
                 {
                     parentLayer = this.Layer.ParentLayer;
                 }
                 PathfinderNode newFindParentNode = new PathfinderNode(parentLayer);
                 newFindParentNode.Node_Add(this);
                 newFindParentNode.Node_Add(nodeToAdd);
                 newFindParentNode.SpanCalc();
                 this.RaiseConnections();
                 nodeToAdd.RaiseConnections();
                 newFindParentNode.Layer.Network.FindParentNode_Add(newFindParentNode);
             }
             else if (nodeToAdd != null)
             {
                 nodeToAdd.Node_Add(this);
                 if (nodeToAdd.NodeCount >= 4)
                 {
                     nodeToAdd.Split();
                 }
                 else
                 {
                     nodeToAdd.SpanCalc();
                     this.RaiseConnections();
                     if (nodeToAdd.ParentNode == null)
                     {
                         nodeToAdd.Layer.Network.FindParentNode_Add(nodeToAdd);
                     }
                 }
             }
         }
         else if (this.ConnectionCount > 0)
         {
             PathfinderLayer layer2;
             if (this.Layer.ParentLayer == null)
             {
                 layer2 = new PathfinderLayer(this.Layer.Network);
             }
             else
             {
                 layer2 = this.Layer.ParentLayer;
             }
             PathfinderNode node5 = new PathfinderNode(layer2);
             node5.Node_Add(this);
             node5.SpanCalc();
             this.RaiseConnections();
             node5.Layer.Network.FindParentNode_Add(node5);
         }
     }
 }
Example #5
0
 public void NodeLayer_Add(PathfinderLayer NewNodeLayer)
 {
     if (this.NodeLayerCount > 0)
     {
         this.NodeLayers[this.NodeLayerCount - 1].ParentLayer = NewNodeLayer;
     }
     this.NodeLayers = (PathfinderLayer[]) Utils.CopyArray((Array) this.NodeLayers, new PathfinderLayer[this.NodeLayerCount + 1]);
     this.NodeLayers[this.NodeLayerCount] = NewNodeLayer;
     this.NodeLayers[this.NodeLayerCount].Network_LayerNum = this.NodeLayerCount;
     this.NodeLayerCount++;
 }