public void OpenClose(GameObject neededpanel) { if (neededpanel == AllOptions && PoseWavePanel.active == true) { // gm.mode = null; PoseWavePanel.SetActive(false); } else if (neededpanel == PoseWavePanel && AllOptions.active == true) { AllOptions.SetActive(false); } neededpanel.SetActive(!neededpanel.activeSelf); }
public void checkstate() { Text text = InfoModeText.GetComponent <Text>(); if (gm.state == "Options") { text.text = "Options"; AllOptions.SetActive(true); PoseWavePanel.SetActive(false); modepanel.SetActive(false); } else if (gm.state == "Information") { text.text = "Information"; AllOptions.SetActive(false); PoseWavePanel.SetActive(false); modepanel.SetActive(false); } else if (gm.state == "SwitchingPose") { text.text = "Here you can choose needed mode or pose"; AllOptions.SetActive(false); PoseWavePanel.SetActive(true); for (int i = 0; i < 5; i++) { ModeButtons[i].interactable = false; ModeButtons[i].GetComponent <Image>().color = new Color(1, 1, 1, 0.5f); ModeButtons[5].interactable = true; ModeButtons[5].GetComponent <Image>().color = new Color(1, 1, 1, 1); } if (Input.touchCount > 0) { Touch touch = Input.GetTouch(0); if (touch.phase == TouchPhase.Began) { beginpoint = touch.position; } else if (touch.phase == TouchPhase.Ended || touch.phase == TouchPhase.Moved) { endpoint = touch.position; touchdirection = (endpoint - beginpoint).normalized; PoseWavePanel.transform.Translate(new Vector3(touchdirection.x, 0, 0) * 1000 * Time.deltaTime); } } // gm.mode = null; } else if (gm.state == "Quit") { text.text = "Quitting from app.\n Please wait untill calibration"; text.color = Color.red; MotionPanel.SetActive(false); StartStopPanel.SetActive(false); AllOptions.SetActive(false); PoseWavePanel.SetActive(false); anglepanel.SetActive(false); foreach (Button mode in ModeButtons) { mode.interactable = false; } gm.mode = null; foreach (Button option in OptionButtons) { option.GetComponent <Button>().interactable = false; } } else if (gm.state == "Chair" || gm.state == "ModifiedChair" || gm.state == "Dinner" || gm.state == "Verticalize" || gm.state == "AntiModifiedChair") { text.text = "Calibrating to " + gm.state + " position"; gm.mode = null; foreach (Button option in OptionButtons) { option.GetComponent <Button>().interactable = false; } foreach (Button mode in ModeButtons) { mode.GetComponent <Button>().interactable = false; } StartStopPanel.SetActive(false); MotionPanel.SetActive(false); PoseWavePanel.SetActive(false); } else { if (gm.state != "Calibrating") { modepanel.SetActive(true); AllOptions.SetActive(false); PoseWavePanel.SetActive(false); foreach (Button option in OptionButtons) { option.GetComponent <Button>().interactable = true; } } } }