Exemple #1
0
    /// <summary>
    /// Going into the state of selecting a new node and confirming it
    /// </summary>
    public void ToggleChangeNode()
    {
        deleteSensorButton.SetActive(sensorManager.SelectingNode);

        if (!sensorManager.SelectingNode && sensorManager.SelectedNode == null)
        {
            sensorManager.DefineNode(); //Start selecting a new node
            changeSensorNodeButton.GetComponentInChildren <Text>().text = "Confirm";
            cancelNodeSelectionButton.SetActive(true);
        }
        else if (sensorManager.SelectingNode && sensorManager.SelectedNode != null)
        {
            //Change the node where Sensor is attached to, clear selected node, and update name of current node
            currentSensor.gameObject.transform.parent = sensorManager.SelectedNode.transform;
            sensorNodeText.text = "Current Node: " + currentSensor.transform.parent.gameObject.name;
            CancelNodeSelection();
        }
    }