Exemple #1
0
        private void OpenMainMenu(VRMenuButton button)
        {
            //Disable the Open Menu button, then enable the close menu button
            m_OpenButton.SetActive(false);
            m_CloseButton.SetActive(true);

            //Calculate the position at which to open the menu in front of the player's vision
            Vector3 pos     = m_Eye.position;
            Vector3 forward = m_Eye.forward;

            //Change the y value to be slightly below the player's head
            forward.y = -0.15f;

            //Normalize to get a direction vector
            forward.Normalize();

            //Move point along the calculated direction vector
            forward *= 0.9f;
            pos     += forward;

            //Calculate the rotation so that the menu is facing the player
            Quaternion viewPlayer = Quaternion.LookRotation(forward);//, m_Eye.transform.up);

            //Set the menu's position to the calculated position and rotation
            m_MenuManager.gameObject.transform.SetPositionAndRotation(pos, viewPlayer);

            //Open the menu to the selected screen
            m_MenuManager.OpenMenu(button.m_ScreenSelection);

            //Reset the time passed to 0
            m_TimePassed = 0f;
        }
Exemple #2
0
            //Function to handle event OnButtonActivate
            public void HandleButtonActivate(VRMenuButton button)
            {
                MenuSounds.PlayOneShot("CLICK", 0);

                if (button.m_ScreenSelection == ScreenTypes.None)
                {
                    return;
                }

                if (button.m_ScreenSelection == ScreenTypes.Back)
                {
                    PreviousScreen();
                }
                else
                {
                    EnableScreen(button.m_ScreenSelection);
                }
            }
Exemple #3
0
 private void CloseMenu(VRMenuButton button)
 {
     Close();
 }