Example #1
0
        private void CheckNodesChanged()
        {
            //Check if the nodes have been changed
            bool hasChangedNodeA = _lastNodeA == null && nodeA != null || _lastNodeA != null && _lastNodeA != nodeA;
            bool hasChangedNodeB = _lastNodeB == null && nodeB != null || _lastNodeB != null && _lastNodeB != nodeB;

            //Invoke OnNodesChanged
            List <PTGraphNode> changedNodes = new List <PTGraphNode>();

            if (hasChangedNodeA)
            {
                changedNodes.Add(nodeA);
            }
            if (hasChangedNodeB)
            {
                changedNodes.Add(nodeB);
            }
            if (changedNodes.Count != 0)
            {
                OnNodesChanged(changedNodes);
            }

            //Update last nodes
            _lastNodeA = nodeA;
            _lastNodeB = nodeB;
        }
Example #2
0
 private void Awake()
 {
     datetimeConstructed = DateTime.Now;
     _lastNodeA          = nodeA;
     _lastNodeB          = nodeB;
     RegisterToNodes();
     OnNodesChanged = (nodes) => RegisterToNodes();
 }
Example #3
0
 public bool IsNodeA(PTGraphNode node)
 {
     return(nodeA != null && nodeA == node || nodeA == null && node == null);
 }
Example #4
0
 public bool ContainsNode(PTGraphNode node)
 {
     return(IsNodeA(node) || IsNodeB(node));
 }
Example #5
0
 public bool IsNodeB(PTGraphNode node)
 {
     return(nodeB != null && nodeB == node || nodeB == null && node == null);
 }
Example #6
0
 /// <summary>
 /// Returns the shortest distance between nodeA and node B.
 /// </summary>
 /// <param name="nodeA"></param>
 /// <param name="nodeB"></param>
 /// <returns>Returns the distance if two nodes are connected. Returns -1 if they are not.</returns>
 public static int ShortestDistanceBetween(PTGraphNode nodeA, PTGraphNode nodeB)
 {
     throw new NotImplementedException();
 }
Example #7
0
 /// <summary>
 /// Find the shortest path to a node from this node
 /// </summary>
 /// <param name="destination"></param>
 /// <returns>The list with right sequence</returns>
 public List <PTGraphEdge> ShortestDistanceTo(PTGraphNode destination)
 {
     throw new NotImplementedException();
 }