Ejemplo n.º 1
0
        public void SelectNode(TectonicFaultNode node)
        {
            Selection = SelectionState.SingleNode;

            SelectedNode          = node;
            SelectedNode.Material = FaultMaterialHighlighted;
        }
Ejemplo n.º 2
0
        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;
                }
            }
        }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
 public TectonicFaultNode NodeOther(TectonicFaultNode main)
 {
     if (NodeA == main)
     {
         return(NodeB);
     }
     else if (NodeB == main)
     {
         return(NodeA);
     }
     else
     {
         return(null);
     }
 }
Ejemplo n.º 5
0
 public void MoveNode(TectonicFaultNode node, Vector3 pos)
 {
     node.CardinalPos = pos;
 }