Пример #1
0
 public PathFindingSystem.PFNode AddNode(Vector2 v2Pos, PathFindingSystem.PFNode xConnectTo, ushort iID)
 {
     PathFindingSystem.PFNode add = new PathFindingSystem.PFNode(v2Pos, iID);
     if (xConnectTo != null)
     {
         this.ConnectNodes(add, xConnectTo);
     }
     this.lxNodes.Add(add);
     this.dixNodeDictionary[add.iID] = add;
     return add;
 }
Пример #2
0
 public void ConnectNodes(PathFindingSystem.PFNode xNode1, PathFindingSystem.PFNode xNode2)
 {
     xNode1.lxConnectedNodes.Add(new PathFindingSystem.Connection(xNode1, xNode2));
     xNode2.lxConnectedNodes.Add(new PathFindingSystem.Connection(xNode2, xNode1));
 }
Пример #3
0
 public PathFindingSystem.PFNode AddNode(Vector2 v2Pos, PathFindingSystem.PFNode xConnectTo)
 {
     ushort expr_08 = PathFindingSystem.PFNode.IDPool;
     PathFindingSystem.PFNode.IDPool = Convert.ToUInt16(expr_08 + 1);
     return this.AddNode(v2Pos, xConnectTo, expr_08);
 }
Пример #4
0
 public void CompareNode(PathFindingSystem.WorkNode xNewNode)
 {
     if (this.xShortestPathNode == null)
     {
         this.xShortestPathNode = xNewNode;
         this.fShortestPath = xNewNode.fShortestPath + Vector2.Distance(xNewNode.xOwnedNode.v2Position, this.xShortestPathNode.xOwnedNode.v2Position);
         return;
     }
     float fDistance = Vector2.Distance(xNewNode.xOwnedNode.v2Position, this.xShortestPathNode.xOwnedNode.v2Position);
     if (xNewNode.fShortestPath + fDistance < this.fShortestPath)
     {
         this.fShortestPath = xNewNode.fShortestPath + fDistance;
         this.xShortestPathNode = xNewNode;
     }
 }
Пример #5
0
 public WorkNode(PathFindingSystem.PFNode xNode)
 {
     this.xOwnedNode = xNode;
 }
Пример #6
0
 public void ToggleConnection(PathFindingSystem.PFNode xTo)
 {
     for (int i = 0; i < this.lxConnectedNodes.Count; i++)
     {
         if (this.lxConnectedNodes[i].xTo == xTo)
         {
             this.lxConnectedNodes.RemoveAt(i--);
             return;
         }
     }
     this.lxConnectedNodes.Add(new PathFindingSystem.Connection(this, xTo));
 }
Пример #7
0
 public Connection(PathFindingSystem.PFNode xFrom, PathFindingSystem.PFNode xTo)
 {
     this.xTo = xTo;
     this.fDistance = Vector2.Distance(xFrom.v2Position, xTo.v2Position);
 }
Пример #8
0
 public PathFindingSystem.WorkNode GetNodeFromList(List<PathFindingSystem.WorkNode> list, PathFindingSystem.PFNode node)
 {
     for (int i = 0; i < list.Count; i++)
     {
         if (list[i].xOwnedNode == node)
         {
             return list[i];
         }
     }
     return null;
 }