private void TriggerAnimation(FinchController controller, FinchControllerElement element, GameObject model)
 {
     if (controller.GetPressDown(element))
     {
         model.transform.localPosition = new Vector3(0, 0, 0.021f);
     }
     else if (controller.GetPressUp(element))
     {
         model.transform.localPosition = new Vector3(0, 0, 0);
     }
 }
 private void HandleMaterialChange(FinchController controller, MeshRenderer Renderer, int materialIndex, Material pressed, Material unpressed, FinchControllerElement element)
 {
     if (controller.GetPressDown(element))
     {
         Material[] arrayCopy = Renderer.materials;
         arrayCopy[materialIndex] = pressed;
         Renderer.materials       = arrayCopy;
     }
     else if (controller.GetPressUp(element))
     {
         Material[] arrayCopy = Renderer.materials;
         arrayCopy[materialIndex] = unpressed;
         Renderer.materials       = arrayCopy;
     }
 }
Пример #3
0
        private static void UpdateFinch()
        {
            if (finchProvider != null)
            {
                finchProvider.ReadState(State);
            }

            switch (FinchSettings.DeviceType)
            {
            case FinchControllerType.Dash:
            {
                for (int i = 0; i < (int)FinchChirality.Last; ++i)
                {
                    if (State.CalibrationButtonPressed[i])
                    {
                        Calibrate((FinchChirality)i);

                        if (FinchSettings.RecenterMode == FinchRecenterMode.Forward)
                        {
                            UnityEngine.XR.InputTracking.Recenter();
                        }
                    }
                }
                break;
            }

            case FinchControllerType.Shift:
            {
                if ((LeftController.GetPress(FinchControllerElement.ButtonZero) && RightController.GetPressDown(FinchControllerElement.ButtonZero)) ||
                    (RightController.GetPress(FinchControllerElement.ButtonZero) && LeftController.GetPressDown(FinchControllerElement.ButtonZero)))
                {
                    Calibrate(FinchChirality.Right);
                    Calibrate(FinchChirality.Left);

                    if (FinchSettings.RecenterMode == FinchRecenterMode.Forward)
                    {
                        UnityEngine.XR.InputTracking.Recenter();
                    }
                }
                break;
            }
            }

            if (tryToAssignControllersNextUpdate)
            {
                tryToAssignControllersNextUpdate = !AssignControllers();
            }
        }
Пример #4
0
        private bool CalibrationButtonPress()
        {
            if (FinchController.Left.IsConnected && FinchController.Right.IsConnected)
            {
                return(FinchController.GetPressDown(FinchChirality.Both, FinchControllerElement.HomeButton));
            }

            if (FinchController.Left.IsConnected)
            {
                return(FinchController.GetPressDown(FinchChirality.Left, FinchControllerElement.HomeButton));
            }

            if (FinchController.Right.IsConnected)
            {
                return(FinchController.GetPressDown(FinchChirality.Right, FinchControllerElement.HomeButton));
            }

            return(false);
        }