예제 #1
0
        protected void UpdateButtonStates()
        {
            for (int index = 0; index < NVRButtonsHelper.Array.Length; index++)
            {
                NVRButtons      nvrbutton = NVRButtonsHelper.Array[index];
                NVRButtonInputs button    = Inputs[nvrbutton];
                button.Axis          = InputDevice.GetAxis2D(nvrbutton);
                button.SingleAxis    = InputDevice.GetAxis1D(nvrbutton);
                button.PressDown     = InputDevice.GetPressDown(nvrbutton);
                button.PressUp       = InputDevice.GetPressUp(nvrbutton);
                button.IsPressed     = InputDevice.GetPress(nvrbutton);
                button.TouchDown     = InputDevice.GetTouchDown(nvrbutton);
                button.TouchUp       = InputDevice.GetTouchUp(nvrbutton);
                button.IsTouched     = InputDevice.GetTouch(nvrbutton);
                button.NearTouchDown = InputDevice.GetNearTouchDown(nvrbutton);
                button.NearTouchUp   = InputDevice.GetNearTouchUp(nvrbutton);
                button.IsNearTouched = InputDevice.GetNearTouch(nvrbutton);
            }

            HoldButtonPressed = Inputs[HoldButton].IsPressed;
            HoldButtonDown    = Inputs[HoldButton].PressDown;
            HoldButtonUp      = Inputs[HoldButton].PressUp;
            HoldButtonAxis    = Inputs[HoldButton].SingleAxis;

            UseButtonPressed = Inputs[UseButton].IsPressed;
            UseButtonDown    = Inputs[UseButton].PressDown;
            UseButtonUp      = Inputs[UseButton].PressUp;
            UseButtonAxis    = Inputs[UseButton].SingleAxis;
        }
예제 #2
0
        private void Update()
        {
            NVRInputDevice   nvrinputDevice   = (NVRInputDevice)UnityEngine.Object.FindObjectOfType(typeof(NVRInputDevice));
            PlayerController playerController = (PlayerController)UnityEngine.Object.FindObjectOfType(typeof(PlayerController));
            Vector2          axis2D           = nvrinputDevice.GetAxis2D(NVRButtons.Axis2);

            if (Input.GetKeyDown(KeyCode.H))
            {
                foreach (GameObject gameObject in UnityEngine.Object.FindObjectsOfType <GameObject>())
                {
                    if (gameObject.layer == 8)
                    {
                        gameObject.layer = 0;
                    }
                }
            }
            if (Input.GetKeyDown(KeyCode.BackQuote))
            {
                this.debugVisible = !this.debugVisible;
            }
            if (Input.GetKeyDown(KeyCode.F2))
            {
                this.freecamEnabled = !this.freecamEnabled;
            }
            if (this.freecamEnabled)
            {
                if (Input.GetKeyDown(KeyCode.F3))
                {
                    Debug.Log("Toggle vertical control: " + this.verticalControl.ToString());
                    this.verticalControl = !this.verticalControl;
                }
                if (Input.GetKeyDown(KeyCode.F4))
                {
                    this.speed = ((this.speed > 10f) ? 0f : (this.speed + 1f));
                    Debug.Log("freecam speed: " + this.speed);
                }
                if ((double)nvrinputDevice.GetAxis2D(NVRButtons.Touchpad).y > 0.5 && this.verticalControl)
                {
                    playerController.CachedTransform.Translate(0f, this.speed * Time.deltaTime, 0f, Space.World);
                }
                if ((double)nvrinputDevice.GetAxis2D(NVRButtons.Touchpad).y < -0.5 && this.verticalControl)
                {
                    playerController.CachedTransform.Translate(0f, -(this.speed * Time.deltaTime), 0f, Space.World);
                }
                if ((double)axis2D.x < -0.3)
                {
                    playerController.CachedTransform.Rotate(Vector3.up, -(this.speed * 30f * Time.deltaTime * Math.Abs(axis2D.x)));
                }
                if ((double)axis2D.x > 0.6)
                {
                    playerController.CachedTransform.Rotate(Vector3.up, this.speed * 30f * Time.deltaTime * Math.Abs(axis2D.x));
                }
                if ((double)axis2D.y < -0.6)
                {
                    playerController.CachedTransform.Translate(0f, 0f, -(this.speed * Time.deltaTime * Math.Abs(axis2D.y)), Space.Self);
                }
                if ((double)axis2D.y > 0.3)
                {
                    playerController.CachedTransform.Translate(0f, 0f, this.speed * Time.deltaTime * axis2D.y, Space.Self);
                }
            }
            if (Input.GetKeyDown(KeyCode.F5))
            {
                int num = 0;
                foreach (MeshRenderer meshRenderer in UnityEngine.Object.FindObjectsOfType <MeshRenderer>())
                {
                    if (meshRenderer.material != null && meshRenderer.material.name != null && meshRenderer.material.name.Contains("trigger"))
                    {
                        num++;
                    }
                }
                Debug.Log("Trigger meshes found: " + num);
            }
            if (Input.GetKeyDown(KeyCode.F6))
            {
                Material material = new Material(UnityEngine.Object.FindObjectOfType <MeshRenderer>().material);
                foreach (MeshRenderer meshRenderer2 in UnityEngine.Object.FindObjectsOfType <MeshRenderer>())
                {
                    Material material2 = meshRenderer2.material;
                    meshRenderer2.material = material;
                    material = material2;
                }
            }
            int num2 = 0;

            if (Input.GetKey(KeyCode.LeftShift))
            {
                num2 = 8;
            }
            if (Input.GetKeyDown(KeyCode.Keypad1))
            {
                StationController stationController = UnityEngine.Object.FindObjectOfType <StationController>();
                if (stationController != null)
                {
                    stationController.ChangeAlternativeLevel("AccPlus_Stomach_MASTER");
                    stationController.BroadcastLevelComplete();
                }
                return;
            }
            if (Input.GetKeyDown(KeyCode.Keypad2))
            {
                StationController stationController2 = UnityEngine.Object.FindObjectOfType <StationController>();
                if (stationController2 != null)
                {
                    stationController2.ChangeAlternativeLevel("AccPlus_Finale_MASTER");
                    stationController2.BroadcastLevelComplete();
                }
                return;
            }
            if (Input.GetKeyDown(KeyCode.Keypad3))
            {
                StationController stationController3 = UnityEngine.Object.FindObjectOfType <StationController>();
                if (stationController3 != null)
                {
                    stationController3.ChangeAlternativeLevel("AccPlus_Arg_MASTER");
                    stationController3.BroadcastLevelComplete();
                }
                return;
            }
            if (Input.GetKeyDown(KeyCode.Keypad4))
            {
                StationController stationController4 = UnityEngine.Object.FindObjectOfType <StationController>();
                if (stationController4 != null)
                {
                    stationController4.ChangeAlternativeLevel("AccPlus_Office_MASTER");
                    stationController4.BroadcastLevelComplete();
                }
                return;
            }
            if (Input.GetKeyDown(KeyCode.Alpha1))
            {
                SceneManager.LoadScene(num2, LoadSceneMode.Additive);
                return;
            }
            if (Input.GetKeyDown(KeyCode.Alpha2))
            {
                SceneManager.LoadScene(1 + num2, LoadSceneMode.Additive);
                return;
            }
            if (Input.GetKeyDown(KeyCode.Alpha3))
            {
                SceneManager.LoadScene(2 + num2, LoadSceneMode.Additive);
                return;
            }
            if (Input.GetKeyDown(KeyCode.Alpha4))
            {
                SceneManager.LoadScene(3 + num2, LoadSceneMode.Additive);
                return;
            }
            if (Input.GetKeyDown(KeyCode.Alpha5))
            {
                SceneManager.LoadScene(4 + num2, LoadSceneMode.Additive);
                return;
            }
            if (Input.GetKeyDown(KeyCode.Alpha6))
            {
                SceneManager.LoadScene(5 + num2, LoadSceneMode.Additive);
                return;
            }
            if (Input.GetKeyDown(KeyCode.Alpha7))
            {
                SceneManager.LoadScene(6 + num2, LoadSceneMode.Additive);
                return;
            }
            if (Input.GetKeyDown(KeyCode.Alpha8))
            {
                SceneManager.LoadScene(7 + num2, LoadSceneMode.Additive);
            }
        }