public void NavigationMachineChoice(bool start) //called by OK-Buttons in Navigation Panel { string[] machineStateArray; if (start) { machineStateArray = parser.machineStates[uiController.navigationMachineChoice[0].value]; currentMaterial = startMaterial; //define material parser.machines[uiController.navigationMachineChoice[0].value].GetComponent <Renderer>().material = currentMaterial; //Color choosen machine } else { machineStateArray = parser.machineStates[uiController.navigationMachineChoice[1].value]; machinePanelControl.machineChoice.value = uiController.navigationMachineChoice[1].value; machinePanelControl.SetMachine(); currentMaterial = endMaterial; //define material parser.machines[uiController.navigationMachineChoice[1].value].GetComponent <Renderer>().material = currentMaterial; //color choosen machine } foreach (GameObject state in parser.states) { if (state.name == machineStateArray[1]) { state.GetComponent <Renderer>().material = currentMaterial; SetStartEnd(state); state.transform.localScale = Vector3.one * parser.stateSize * 1.3f; break; } } mapChoiceEnabled = true; }
private void OnMouseDown() { //in inspection scene set machine for navigation as start or target if (parser.inspection && navigation.mapChoiceEnabled) { for (int i = 0; i < parser.machineStates.Count; i++) { if (gameObject.name == parser.machineStates[i][0]) { for (int j = 0; j < parser.states.Count; j++) { if (parser.machineStates[i][1] == parser.states[j].name) { if (!navigation.startDefined) { parser.states[j].GetComponent <Renderer>().material = Resources.Load("Materials/State_START", typeof(Material)) as Material; gameObject.GetComponent <Renderer>().material = Resources.Load("Materials/State_START", typeof(Material)) as Material; uIController.navigationMachineChoice[0].value = i; } else { parser.states[j].GetComponent <Renderer>().material = Resources.Load("Materials/State_TARGET", typeof(Material)) as Material; gameObject.GetComponent <Renderer>().material = Resources.Load("Materials/State_TARGET", typeof(Material)) as Material; machinePanelControl.machineChoice.value = i; uIController.navigationMachineChoice[1].value = i; machinePanelControl.SetMachine(); } navigation.SetStartEnd(parser.states[j]); parser.states[j].transform.localScale = Vector3.one * parser.stateSize * 1.3f; } } } } } //in planning-scene show MTConnect data when clicking on machine else { uIController.machineName = gameObject.transform.name; uIController.IOMachineInfoPanel(true); } }