// Update is called once per frame void Update() { // Check if the menu is showing if (vrManager.menuManager.IsShowing()) { // Check if the hand is touching this menu item if (boxColliderGesture.bounds.Intersects(boxColliderMenuRestart.bounds)) { // Reset the game vrManager.Reset(); // The menu changes color menuRestart.GetComponent <AlphaChanger>().ChangeAlpha(1.0f); } else // The hand is not touching this menu { // The menu keep the default color menuRestart.GetComponent <AlphaChanger>().ChangeAlpha(0.5f); } // Check if the hand is touching this menu item if (boxColliderGesture.bounds.Intersects(boxColliderMenuCubeFactory.bounds)) { // The menu changes the alpha menuCubeFactory.GetComponent <AlphaChanger>().ChangeAlpha(1.0f); // The factory starts creating objects cubeFactory.StartCreating(); } else // The hand is not touching this menu { // The menu changes the alpha menuCubeFactory.GetComponent <AlphaChanger>().ChangeAlpha(0.5f); // The factory stops cubeFactory.StopCreating(); } // Check if the hand is touching this menu item if (boxColliderGesture.bounds.Intersects(boxColliderMenuSphereFactory.bounds)) { // The menu changes the alpha menuSphereFactory.GetComponent <AlphaChanger>().ChangeAlpha(1.0f); // The factory starts sphereFactory.StartCreating(); } else // The hand is not touching this menu { // The menu changes the alpha menuSphereFactory.GetComponent <AlphaChanger>().ChangeAlpha(0.5f); // The factory stops sphereFactory.StopCreating(); } } // Check if the hand is touching the button to walk if (boxColliderGesture.bounds.Intersects(boxColliderMenuWalk.bounds)) { // The button changes colour menuWalk.GetComponent <AlphaChanger>().ChangeAlpha(0.8f); // Check if the menu is not showing if (!vrManager.menuManager.IsShowing()) { // Move the player (walks) vrManager.MoveForward(); } } else // The hand is not touching the button { // The button keeps the default alpha menuWalk.GetComponent <AlphaChanger>().ChangeAlpha(-1f); } }