public void SelectNode(TectonicFaultNode node)
        {
            Selection = SelectionState.SingleNode;

            SelectedNode          = node;
            SelectedNode.Material = FaultMaterialHighlighted;
        }
        public void RemoveNode(TectonicFaultNode node)
        {
            ValidateNodeContainer();

            for (int i = 0; i < NodeContainer.childCount; i++)
            {
                var thisNode = NodeContainer.GetChild(i).GetComponent <TectonicFaultNode>();
                if (thisNode == node)
                {
                    Nodes.Remove(thisNode);

                    var thisNodeLinks = thisNode.Links;
                    Debug.Log(thisNodeLinks.Count);
                    for (int j = thisNodeLinks.Count - 1; j >= 0; j--)
                    {
                        // Get affected nodes and remove their references to links
                        var otherNode = thisNodeLinks[j].NodeOther(thisNode);
                        otherNode.Links.Remove(thisNodeLinks[j]);

                        // Remove the link
                        RemoveLink(thisNodeLinks[j]);
                    }

                    Destroy(thisNode.gameObject);
                    thisNode = null;
                    break;
                }
            }
        }
        public void AddNode(Vector3 pos)
        {
            ValidateNodeContainer();

            TectonicFaultNode node = Instantiate(
                Resources.Load <TectonicFaultNode>(ResourcePath.FaultNode),
                NodeContainer
                );

            node.name        = "Fault Node #" + NodeContainer.childCount.ToString().PadLeft(3, '0');
            node.CardinalPos = pos;

            Nodes.Add(node);
        }
Example #4
0
 public TectonicFaultNode NodeOther(TectonicFaultNode main)
 {
     if (NodeA == main)
     {
         return(NodeB);
     }
     else if (NodeB == main)
     {
         return(NodeA);
     }
     else
     {
         return(null);
     }
 }
 public void MoveNode(TectonicFaultNode node, Vector3 pos)
 {
     node.CardinalPos = pos;
 }