void Close(ScreenAnim script) { foreach (ScreenAnim s in UIScreens.GetComponentsInChildren <ScreenAnim>()) { if (script != s) { s.OpenAnim(); } } script.OutAnim(); script.Toggle(); }
// Update is called once per frame void Update() { if (Controller.GetHairTriggerDown()) { if (collidingObject) { if (collidingObject.name == "Plane") { ScreenAnim script = collidingObject.GetComponent <ScreenAnim>(); if (!script.Opened()) { Open(script); counter++; } else if (script.Opened()) { Close(script); } } } } if (counter == 3) { call.SetActive(true); } if (Controller.GetPressDown(SteamVR_Controller.ButtonMask.Grip) && call.activeSelf) { counter = 0; call.SetActive(false); video.alpha = 1f; } else if (Controller.GetPressDown(SteamVR_Controller.ButtonMask.Grip) && video.alpha == 1f) { video.alpha = 0f; } }